Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Scan Sampler to Use Previous Scan Level #273

Open
mcbrider5002 opened this issue Feb 25, 2024 · 0 comments
Open

Refactor Scan Sampler to Use Previous Scan Level #273

mcbrider5002 opened this issue Feb 25, 2024 · 0 comments

Comments

@mcbrider5002
Copy link
Collaborator

mcbrider5002 commented Feb 25, 2024

Currently IndependentMassSpectrometer supports two kinds of arguments to generate scan times. (Example.) The first is a dictionary mapping MS-levels (int) to either static values or a callable (of no arguments). The second is an object supporting a function with the signature sample(current_level, next_level, current_rt). This is intended to be used with a ScanTimeSampler.

A consequence of this is that the simulated mass spec must ask for the scan level of the next scan before it can compute the current RT. However, the TaskFilter used in dynamically adjusting scan times must know the current RT before deciding what the next scan (and its level) will be. For this to work the call to compute the scan time therefore had to be moved and the scan level of the next scan ignored by passing None in this commit.

To resupport this functionality, the code must therefore be changed so that scan samplers use a method sample(previous_level, current_level, current_rt). This preserves the idea that the scan time depends on whether you are switching MS level while not requiring us to "see into the future" and allowing TaskFilter to get the current RT.

Additionally, on initialising an IndependentMassSpectrometer, it could cast an argument, if it is given as dictionary, to a subclass of ScanTimeSampler. DefaultScanTimeSampler requires only minor changes to account for this (i.e. must allow the values in the dictionary to be callables rather than just values). This would allow us to avoid having messy type handling code in the body of IndependentMassSpectrometer while retaining backwards compatibility. (i.e. We just call sample on it regardless of which form the argument was given in.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant