opentimspy package

Submodules

opentimspy.opentims module

class opentimspy.opentims.OpenTIMS(analysis_directory)

Bases: object

frame2retention_time(frames)
frame_array(frame)

Get a 2D array of data for a given frame.

Parameters

frame (int, iterable, slice) – Frame to output.

Returns

Array with 4 columns: frame numbers, scan numbers, time of flights, and intensities in the selected frame.

Return type

np.array

frame_arrays(frames)

Get raw data from a selection of frames.

Contains only those types that share the underlying type (uint32), which consists of ‘frame’,’scan’,’tof’, and ‘intensity’.

Parameters

frames (iterable) – Frames to chose.

Returns

raw data from the selection of frames.

Return type

np.array

frame_arrays_slice(frames_slice)

Get raw data from a slice of frames.

Contains only those types that share the underlying type (uint32), which consists of ‘frame’,’scan’,’tof’, and ‘intensity’.

Parameters

frames_slice (slice) – A slice defining which frames to chose.

Returns

raw data from the selection of frames.

Return type

np.array

framesTIC()

Get the Total Ion Current for each frame.

Returns

Total Ion Current values per each frame (sums of intensities for each frame).

Return type

np.array

get_hash(columns=('frame', 'scan', 'tof', 'intensity'), algo=<class '_blake2.blake2b'>)

Calculate a data-set-wide hash.

Defaults to raw data that are all uint32.

Parameters
  • columns (list) – Columns for which to calculate the hash.

  • algo (object) – Class with a call method for restarting hash calculations and an update method that accepts data.

Returns

A hash.

Return type

binary str

get_hashes(columns=('frame', 'scan', 'tof', 'intensity'), algo=<class '_blake2.blake2b'>)

Calculate a hashes for each frame.

Defaults to raw data that are all uint32.

Parameters
  • columns (list) – Columns for which to calculate the hash.

  • algo (object) – Class with a call method for restarting hash calculations and an update method that accepts data.

Returns

Frame specifc hashes.

Return type

list

peaks_per_frame_cnts(frames, convert=True)

Return the numbers of peaks in chosen frames.

Parameters

frames (list) – frames to extract the number of peaks from.

Returns;

np.array: Number of peaks in each frame.

query(frames, columns=('frame', 'scan', 'tof', 'intensity', 'mz', 'inv_ion_mobility', 'retention_time'))

Get data from a selection of frames.

Parameters
  • frames (int, iterable) – Frames to choose. Passing an integer results in extracting that one frame.

  • columns (tuple) – which columns to extract? Defaults to all possible columns.

Returns

columns to numpy array mapping.

Return type

dict

query_iter(frames, columns=('frame', 'scan', 'tof', 'intensity', 'mz', 'inv_ion_mobility', 'retention_time'))

Iterate data from a selection of frames.

Parameters
  • frames (int, iterable, slice) – Frames to choose. Passing an integer results in extracting that one frame.

  • columns (tuple) – which columns to extract? Defaults to all possible columns.

Yields

dict – columnt to numpy array mapping.

rt_query(min_retention_time, max_retention_time, columns=('frame', 'scan', 'tof', 'intensity', 'mz', 'inv_ion_mobility', 'retention_time'))

Get data from a selection of frames based on retention times.

Get all frames corresponding to retention times in a set “[min_retention_time, max_retention_time)”.

Parameters
  • min_retention_time (float) – Minimal retention time.

  • max_retention_time (float) – Maximal retention time to choose.

  • columns (tuple) – which columns to extract? Defaults to all possible columns.

Returns

column to numpy array mapping.

Return type

dict

rt_query_iter(min_retention_time, max_retention_time, columns=('frame', 'scan', 'tof', 'intensity', 'mz', 'inv_ion_mobility', 'retention_time'))

Iterate data from a selection of frames based on retention times.

Get all frames corresponding to retention times in a set “[min_retention_time, max_retention_time)”.

Parameters
  • min_retention_time (float) – Minimal retention time.

  • max_retention_time (float) – Maximal retention time to choose.

  • columns (tuple) – which columns to extract? Defaults to all possible columns.

Yields

dict – column to numpy array mapping.

opentimspy.opentims.hash_frame(X, columns=('frame', 'scan', 'tof', 'intensity'), algo=<class '_blake2.blake2b'>)

Module contents