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

How to access readers in Python? #45

Open
mjdinsmore opened this issue Jun 26, 2024 · 1 comment
Open

How to access readers in Python? #45

mjdinsmore opened this issue Jun 26, 2024 · 1 comment

Comments

@mjdinsmore
Copy link

mjdinsmore commented Jun 26, 2024

This is probably a stupid question, but as someone who was previously leveraging the Aston package but needs to update to this because the Aston package requirement for an older, unsupported Python version....

How do I access the readers in entab? I don't see any section in the README to help illustrate how someone might migrate from Aston to this new package. I used to have code like:

`def test_aston_import():
from aston.tracefile.agilent_uv import AgilentMWD2

instance = AgilentMWD2()
assert isinstance(instance, AgilentMWD2)`

but one cannot simply replace the "aston" with "entab". Any insight would be welcome. Thank you!

@bovee
Copy link
Owner

bovee commented Jun 27, 2024

No, I think this is a good question. There's not much documentation for Python, but there is an example in the sub-directory: https://github.com/bovee/entab/tree/main/entab-py

The instance you get is going to be simpler/lower-level from what Aston returns and lacks some of the convenience methods so if you want e.g. an extracted trace you're going to have to compute it manually:

instance = Reader(filename='dad1A.ch')
assert instance.parser == 'chemstation_dad'
eic = {}
for scan in instance:
    if scan.wavelength == 250:
        eic[scan.time] = scan.intensity

Another issue might be that entab is still missing some parsers from Aston including a couple of the ones for files with magic 0331 like AgilentMWD2 (see #42 for another one). I don't know if you can still run Aston in a docker image or something with old Python for now, but that might be the best option?

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

2 participants