DataSeries
- class reciprocalspaceship.DataSeries(data=None, index=None, dtype: Dtype | None = None, name=None, copy: bool | None = None, fastpath: bool | lib.NoDefault = <no_default>)[source]
Bases:
Series
One-dimensional ndarray with axis labels, representing a slice of a DataSet. DataSeries objects inherit methods from
pd.Series
, and as such have support for statistical methods that automatically exclude missing data (represented as NaN).Operations between DataSeries align values on their associated index values so they do not need to have the same length.
For more information on the attributes and methods available with DataSeries objects, see the Pandas documentation.
- Parameters:
data (array-like, Iterable, dict, or scalar value) – data to be stored in DataSeries.
index (array-like or Index) – Values must be hashable and have the same length as data. Non-unique index values are allowed. Will default to RangeIndex (0, 1, 2, …, n) if not provided. If a dict is provided as data and a index is given, index will override the keys found in the dict.
dtype (str, numpy.dtype, or ExtensionDtype, optional) – Data type for the DataSeries.
name (str, optional) – The name to give to the DataSeries.
copy (bool, default False) – Copy input data.
Attributes
Methods
Convert dtype of DataSeries from the Friedel equivalent.
Infer MTZ dtype from column name and underlying data.
Convert dtype of DataSeries to the Friedel equivalent.
- from_friedel_dtype()[source]
Convert dtype of DataSeries from the Friedel equivalent. If DataSeries is not a Friedel-related dtype, it is returned unchanged.
- Returns:
DataSeries
See also
DataSeries.to_friedel_dtype
Convert dtype of DataSeries to the Friedel equivalent
Examples
DataSeries has a Friedel equivalent:
>>> s = rs.DataSeries([1, 2, 3], dtype="FriedelIntensity") >>> s 0 1.0 1 2.0 2 3.0 dtype: FriedelIntensity >>> s.from_friedel_dtype() 0 1.0 1 2.0 2 3.0 dtype: Intensity
DataSeries does not have a Friedel equivalent:
>>> s = rs.DataSeries([1, 2, 3], dtype="HKL") >>> s 0 1 1 2 2 3 dtype: HKL >>> s.from_friedel_dtype() 0 1 1 2 2 3 dtype: HKL
- infer_mtz_dtype()[source]
Infer MTZ dtype from column name and underlying data.
If name does not match a common MTZ column, the method will return an MTZInt or MTZReal depending on whether the data is composed of integers or floats, respectively. If the data is non-numeric, the returned dtype will be unchanged. If input dataseries is already a MTZDtype, it will be returned unchanged.
- Returns:
DataSeries
See also
DataSet.infer_mtz_dtypes
Infer MTZ dtypes for columns in DataSet
Examples
Common intensity column name:
>>> s = rs.DataSeries([1, 2, 3], name="I") >>> s.infer_mtz_dtype() 0 1.0 1 2.0 2 3.0 Name: I, dtype: Intensity
Common intensity column name for anomalous data:
>>> s = rs.DataSeries([1, 2, 3], name="I(+)") >>> s.infer_mtz_dtype() 0 1.0 1 2.0 2 3.0 Name: I(+), dtype: FriedelIntensity
Ambiguous name case:
>>> s = rs.DataSeries([1, 2, 3], name="Something") >>> s.infer_mtz_dtype() 0 1 1 2 2 3 Name: Something, dtype: MTZInt
- to_friedel_dtype()[source]
Convert dtype of DataSeries to the Friedel equivalent. If there is not a Friedel equivalent dtype, the DataSeries is returned unchanged.
- Returns:
DataSeries
See also
DataSeries.from_friedel_dtype
Convert dtype of DataSeries from the Friedel equivalent.
Examples
DataSeries has a Friedel equivalent:
>>> s = rs.DataSeries([1, 2, 3], dtype="Intensity") >>> s 0 1.0 1 2.0 2 3.0 dtype: Intensity >>> s.to_friedel_dtype() 0 1.0 1 2.0 2 3.0 dtype: FriedelIntensity
DataSeries does not have a Friedel equivalent:
>>> s = rs.DataSeries([1, 2, 3], dtype="HKL") >>> s 0 1 1 2 2 3 dtype: HKL >>> s.to_friedel_dtype() 0 1 1 2 2 3 dtype: HKL