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

the acq_name of channel group changed after applying .filter() function #430

Closed
Yuanli-Liu opened this issue Oct 26, 2020 · 3 comments
Closed

Comments

@Yuanli-Liu
Copy link

Yuanli-Liu commented Oct 26, 2020

Python version

('python=3.8.5 | packaged by conda-forge | (default, Aug 29 2020, 01:22:49) \n'
 '[GCC 7.5.0]')
'os=Linux-5.4.0-52-generic-x86_64-with-glibc2.10'
'numpy=1.19.1'
'asammdf=5.22.0'

Code

MDF version

4.10

Code snippet

mf4_reader = MDF("test.mf4")
# channels_namelist is a list of channel name
mf4_reader = mf4_reader.filter(channels_namelist)
for idx, gitem in enumerate(mf4_reader.groups):
    cg = gitem["channel_group"]
    acq_name = cg.acq_name
    print(idx, cg.acq_name, sep="=>")

Description

If we comment line2: mf4_reader.filter(channels_namelist), the output is normal. Otherwise, the output of acq_name are abnormal and most of them are empty.

@Yuanli-Liu
Copy link
Author

Similarly, after calling .filter(), the output of print(mdf.header.comment) is empty.

@Yuanli-Liu Yuanli-Liu reopened this Oct 26, 2020
@JulienGrv
Copy link
Contributor

JulienGrv commented Oct 26, 2020

mf4_reader.header.comment is empty because .filter() returns a new MDF object and you overwrite the original one in your code snippet. Regarding channel groups acq_name, if you use the development branch, I made changes and now channel groups acq_name are conserved after .filter().

Either you wait until next release or you can already try the development branch like this:
pip install git+https://github.com/danielhrisca/asammdf.git@development

Your code could then look like this:

mf4_reader = MDF("test.mf4")
# channels_namelist is a list of channel name
mf4_reader_filtered = mf4_reader.filter(channels_namelist)
print(mf4_reader.header.comment)
for idx, gitem in enumerate(mf4_reader_filtered.groups):
    cg = gitem["channel_group"]
    acq_name = cg.acq_name
    print(idx, cg.acq_name, sep="=>")

@Yuanli-Liu
Copy link
Author

Thank you for your answer sincerely!:tada:

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