Skip to content

Conversation

@MicheleCotrufo
Copy link
Contributor

@MicheleCotrufo MicheleCotrufo commented May 30, 2024

Adding basic support for HR4. Some of the settings (integration time, number of pixels, etc.) were taken from the manual, others were copied from the settings of the SR4, which seems to be the "closest" model. I tried it with my own HR4 spectrometer on Windows 10 and it seems to work well.

Since this device (and other recent ones) only work with the pyseabreeze backend, it might be worth it to add a few instructions to the README regarding how to properly install pyusb in Windows; in my case, I had to manually add a .dll file. I added some new instructions in the README file in this commit, feel free to ignore it or change it.

Test:

================================================= test session starts =================================================
platform win32 -- Python 3.12.0, pytest-8.2.1, pluggy-1.5.0 -- C:\Users\CotrufoResearchLab\Desktop\test_oceanoptics3\Scripts\python.exe
cachedir: .pytest_cache
rootdir: C:\Users\CotrufoResearchLab\Desktop\python-seabreeze
configfile: pytest.ini
collected 28 items

tests/test_backends.py::test_seabreeze_installed PASSED                                                          [  3%]
tests/test_backends.py::test_seabreeze_wrong_backend_requested PASSED                                            [  7%]
tests/test_backends.py::test_seabreeze_any_backend_available[cseabreeze] PASSED                                  [ 10%]
tests/test_backends.py::test_seabreeze_any_backend_available[pyseabreeze] PASSED                                 [ 14%]
tests/test_backends.py::test_seabreeze_cseabreeze_backend_available PASSED                                       [ 17%]
tests/test_backends.py::test_seabreeze_pyseabreeze_backend_available PASSED                                      [ 21%]
tests/test_backends.py::test_seabreeze_cseabreeze_api_init PASSED                                                [ 25%]
tests/test_backends.py::test_seabreeze_pyseabreeze_api_init[any] PASSED                                          [ 28%]
tests/test_backends.py::test_seabreeze_pyseabreeze_api_init[openusb] PASSED                                      [ 32%]
tests/test_backends.py::test_seabreeze_pyseabreeze_api_init[libusb0] PASSED                                      [ 35%]
tests/test_backends.py::test_seabreeze_pyseabreeze_api_init[libusb1] PASSED                                      [ 39%]
tests/test_backends.py::test_seabreeze_compare_backend_feature_interfaces PASSED                                 [ 42%]
tests/test_protocol.py::test_pyseabreeze_protocol_messages PASSED                                                [ 46%]
tests/test_spectrometers.py::TestHardware::test_cant_find_serial[backend(any)] PASSED                            [ 50%]
tests/test_spectrometers.py::TestHardware::test_device_cleanup_on_exit[backend(any)] PASSED                      [ 53%]
tests/test_spectrometers.py::TestHardware::test_read_model[HR4:HR400412-backend(any)] PASSED                     [ 57%]
tests/test_spectrometers.py::TestHardware::test_read_serial_number[HR4:HR400412-backend(any)] PASSED             [ 60%]
tests/test_spectrometers.py::TestHardware::test_crash_may_not_influence_following_tests[HR4:HR400412-backend(any)] SKIPPED [ 64%]
tests/test_spectrometers.py::TestHardware::test_read_intensities[HR4:HR400412-backend(any)] PASSED               [ 67%]
tests/test_spectrometers.py::TestHardware::test_correct_dark_pixels[HR4:HR400412-backend(any)] SKIPPED (does...) [ 71%]
tests/test_spectrometers.py::TestHardware::test_read_wavelengths[HR4:HR400412-backend(any)] PASSED               [ 75%]
tests/test_spectrometers.py::TestHardware::test_read_spectrum[HR4:HR400412-backend(any)] PASSED                  [ 78%]
tests/test_spectrometers.py::TestHardware::test_max_intensity[HR4:HR400412-backend(any)] PASSED                  [ 82%]
tests/test_spectrometers.py::TestHardware::test_integration_time_limits[HR4:HR400412-backend(any)] PASSED        [ 85%]
tests/test_spectrometers.py::TestHardware::test_integration_time[HR4:HR400412-backend(any)] PASSED               [ 89%]
tests/test_spectrometers.py::TestHardware::test_trigger_mode[HR4:HR400412-backend(any)] PASSED                   [ 92%]
tests/test_spectrometers.py::TestHardware::test_trigger_mode_wrong[HR4:HR400412-backend(any)] PASSED             [ 96%]
tests/test_spectrometers.py::TestHardware::test_list_devices_dont_close_opened_devices[backend(any)] PASSED      [100%]

=============================================== short test summary info ===============================================
SKIPPED [1] tests\test_spectrometers.py:237: FIXME: TEST BREAKS OTHER TESTS ON WINDOWS
SKIPPED [1] tests\test_spectrometers.py:265: does not support dark counts
============================================ 26 passed, 2 skipped in 4.36s ============================================

Copy link
Owner

@ap-- ap-- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for your contribution @MicheleCotrufo ❤️

I made a few minor changes to the readme text and added comments to the udev rules

@ap-- ap-- merged commit 15a1205 into ap--:main Jun 1, 2024
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

Successfully merging this pull request may close these issues.

2 participants