pyms.Mixins

Mixins for PyMassSpec Classes.

Classes:

GetIndexTimeMixin()

Mixin class for retention time attributes and methods.

IntensityArrayMixin()

Mixin class for intensity_array attribute.

MassListMixin()

Mixin class to add the mass_list property, which returns a copy of the internal _mass_list attribute.

MaxMinMassMixin()

Mixin class to add the min_mass and max_mass properties, which provide read-only access to the internal _min_mass and _max_mass attributes.

TimeListMixin()

Mixin class to add the time_list property, which returns a copy of the internal _time_list attribute.

class GetIndexTimeMixin[source]

Bases: object

Mixin class for retention time attributes and methods.

Methods:

get_index_at_time(time)

Returns the nearest index corresponding to the given time.

get_time_at_index(ix)

Returns time at given index.

get_index_at_time(time)[source]

Returns the nearest index corresponding to the given time.

Parameters

time (float) – Time in seconds

Return type

int

Returns

Nearest index corresponding to given time

Authors

Lewis Lee, Tim Erwin, Vladimir Likic

Changed in version 2.3.0: Now returns -1 if no index is found.

get_time_at_index(ix)[source]

Returns time at given index.

Parameters

ix (int)

Authors

Lewis Lee, Vladimir Likic

Return type

float

class IntensityArrayMixin[source]

Bases: object

Mixin class for intensity_array attribute.

Attributes:

intensity_array

Returns a copy of the intensity array.

intensity_array_list

Returns a copy of the intensity array as a list of lists of floats.

intensity_matrix

Returns a copy of the intensity matrix.

matrix_list

Returns the intensity matrix as a list of lists of floats.

property intensity_array

Returns a copy of the intensity array.

Return type

ndarray

Returns

Matrix of intensity values.

Authors

Andrew Isaac, Lewis Lee

property intensity_array_list

Returns a copy of the intensity array as a list of lists of floats.

Return type

List[List[float]]

Returns

Matrix of intensity values.

Author

Andrew Isaac

property intensity_matrix

Returns a copy of the intensity matrix.

Return type

ndarray

Returns

Matrix of intensity values.

Author

Andrew Isaac

property matrix_list

Returns the intensity matrix as a list of lists of floats.

Return type

ndarray

Returns

Matrix of intensity values

Author

Andrew Isaac

class MassListMixin[source]

Bases: MaxMinMassMixin

Mixin class to add the mass_list property, which returns a copy of the internal _mass_list attribute.

Attributes:

mass_list

Returns a list of the masses.

property mass_list

Returns a list of the masses.

Authors

Qiao Wang, Andrew Isaac, Vladimir Likic

Return type

List[float]

class MaxMinMassMixin[source]

Bases: object

Mixin class to add the min_mass and max_mass properties, which provide read-only access to the internal _min_mass and _max_mass attributes.

Attributes:

max_mass

Returns the maximum m/z value in the spectrum.

min_mass

Returns the minimum m/z value in the spectrum.

property max_mass

Returns the maximum m/z value in the spectrum.

Author

Andrew Isaac

Return type

Optional[float]

property min_mass

Returns the minimum m/z value in the spectrum.

Author

Andrew Isaac

Return type

Optional[float]

class TimeListMixin[source]

Bases: object

Mixin class to add the time_list property, which returns a copy of the internal _time_list attribute.

Attributes:

time_list

Returns a copy of the time list.

property time_list

Returns a copy of the time list.

Return type

List[float]

Returns

List of retention times

Authors

Andrew Isaac, Lewis Lee, Vladimir Likic