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

Feature: Allow pybv to scale to several units (accomodate different channel types) #50

Closed
sappelhoff opened this issue Nov 5, 2020 · 0 comments · Fixed by #66
Closed
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@sappelhoff
Copy link
Member

Currently pybv only accepts a single unit as a parameter:

pybv/pybv/io.py

Lines 62 to 65 in 76e8bea

unit : str | None
The unit of the exported data. This can be one of 'V', 'mV', 'µV' (or
equivalently 'uV') , 'nV' or None. If None, a suitable unit based on
the selected resolution is chosen automatically.

and that unit is applied to all channels:

pybv/pybv/io.py

Lines 276 to 281 in 76e8bea

for i in range(nchan):
resolution, unit = _optimize_channel_unit(resolutions[i], units[i])
s = r'Ch{}={},,{:0.{precision}f},{}'
print(s.format(i + 1, ch_names[i], resolution, unit,
precision=max(0, int(np.log10(1 / resolution)))),
file=fout)

It would be nice to be able to pass a n_channels long vector of units to pybv, to accommodate different channel types.

For example an auxilliary channel in degrees Celsius, which would be in the unit C.

Note that channel-specific resolutions are already possible, and the proposed feature here is simply a logical extension of that behavior:

pybv/pybv/io.py

Lines 57 to 61 in 76e8bea

resolution : float | ndarray
The resolution **in volts** in which you'd like the data to be stored.
By default, this will be 1e-7, or 0.1 µV. This number controls the
amount of round-trip resolution. This can be either a single float for
all channels or an array with n_channels elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant