-
Notifications
You must be signed in to change notification settings - Fork 1
Implementation of classes 'Device' and 'MeasurementChain' #2
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
base: master
Are you sure you want to change the base?
Conversation
…d problems through mutability of lists
f-brinkmann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Only one question: Do you check if the sampling rates of the Devices agree when you init a MeasurementChain with a list of Devices? I did not find that, but it should be checked in MeasurementChain.init
| # check if device_data is type Signal or None | ||
| if not isinstance(data, (Signal, type(None))): | ||
| raise TypeError('Input data must be type Signal or None.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also checked in Device and could be removed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When removing this check and passing something else then None or a Signal as data to add_device, the sampling-rate-check if not self.sampling_rate == data.sampling_rate: would raise an AttributeError, as the data has no attribute 'sampling_rate'. My thought was to raise a more meaningful error, but I'm not sure whether this is the best solution.
tests/test_mestopy.py
Outdated
| time = [1, 0, 0, 0, 0, 0, 0, 0] | ||
| freq = [1, 1, 1, 1] | ||
| sampling_rate = 44100 | ||
| fft_norm = 'none' | ||
| signal = signal_stub(time, freq, sampling_rate, fft_norm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you put this as a ficture in conftest.py you can reuse it :)
You can have a look at pyfar to see how this works...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I added a conftest.py and defined a flat_freq fixture in my latest commit. :)
Co-authored-by: Fabian Brinkmann <fabian.brinkmann@mailbox.org>
Co-authored-by: Fabian Brinkmann <fabian.brinkmann@mailbox.org>
Co-authored-by: Fabian Brinkmann <fabian.brinkmann@mailbox.org>
Co-authored-by: Fabian Brinkmann <fabian.brinkmann@mailbox.org>
…surementChain Co-authored-by: Fabian Brinkmann <fabian.brinkmann@mailbox.org>
Co-authored-by: Fabian Brinkmann <fabian.brinkmann@mailbox.org>
Thanks a lot for your feedback. I just implemented all of your suggestions for mestopy. |
The classes 'Device' (to hold data of a single device in the measurement chain) and 'MeasurementChain' (to represent the complete measurement chain, including no, one or many devices) were implemented as part of the seminar 'Python for Acoustics and Audio Signal Processing' at TU Berlin.