WasatchPhotonics / ENLIGHTEN

Open-source spectroscopy application for controlling and taking measurements from Wasatch Photonics spectrometers.
https://wasatchphotonics.com/product-category/software/
MIT License
3 stars 6 forks source link

Laser not allowing immediate manual turn-off in Batch Collection #396

Closed mzieg closed 2 months ago

mzieg commented 2 months ago

"I’ve been noticing an issue with Enlighten 4.0.58 where the laser takes a long time (up to ~30 seconds) to turn off after I click the “turn laser off” I’m a bit worried about this causing a safety hazard. It only seems to happen when I am in batch mode. If I am taking 30 second integrations (15 samples at 2000 ms each) and I stop the batch early and click the laser off button, it will take ~30 seconds to turn off the laser."

mzieg commented 2 months ago

I think the fundamental request was fixed by a quick change to BatchCollection.stop, but using this to explore an other reported issue in BatchCollection with LaserMode.Spectrum. I'd thought that was isolated to XS, but it seems to be affecting X/XM as well :-(

The problem is highlighted in the below; the first TakeOneRequest (with the laser enable flags raised) is correct and valid; the second is the problem. Digging...

2024-05-07 17:53:00,719 [0x00002108] enlighten.timing.BatchCollection DEBUG    BatchCollection.start_collection: instantiating TakeOneRequest in laser_mode.spectrum
2024-05-07 17:53:00,719 [0x00002108] wasatch.TakeOneRequest DEBUG    instantiated TakeOneRequest <id 03916-08456-1715118780719668400-24385, avg 1, take_dark False, enable_laser_before True, disable_laser_after True, laser_warmup_ms 3000>
2024-05-07 17:53:00,719 [0x00002108] wasatch.TakeOneRequest DEBUG    --> via: File "Y:\code\ENLIGHTEN\scripts\Enlighten.py", line 262, in <module>
2024-05-07 17:53:00,719 [0x00002108] wasatch.TakeOneRequest DEBUG    --> via: File "Y:\code\ENLIGHTEN\scripts\Enlighten.py", line 248, in main
2024-05-07 17:53:00,719 [0x00002108] wasatch.TakeOneRequest DEBUG    --> via: File "Y:\code\ENLIGHTEN\scripts\Enlighten.py", line 166, in run
2024-05-07 17:53:00,719 [0x00002108] wasatch.TakeOneRequest DEBUG    --> via: File "Y:\code\ENLIGHTEN\enlighten\ui\VCRControls.py", line 246, in start_collection
2024-05-07 17:53:00,719 [0x00002108] wasatch.TakeOneRequest DEBUG    --> via: File "Y:\code\ENLIGHTEN\enlighten\timing\BatchCollection.py", line 349, in start_collection
    take_one_request = TakeOneRequest(take_dark=self.dark_before_batch, enable_laser_before=True, disable_laser_after=True, laser_warmup_ms=self.laser_warmup_ms)
2024-05-07 17:53:00,719 [0x00002108] wasatch.TakeOneRequest DEBUG    --> via: File "y:\code\Wasatch.PY\wasatch\TakeOneRequest.py", line 21, in __init__
2024-05-07 17:53:00,719 [0x00002108] enlighten.timing.BatchCollection DEBUG    starting laser_mode spectrum, so take_one_request TakeOneRequest <id 03916-08456-1715118780719668400-24385, avg 1, take_dark False, enable_laser_before True, disable_laser_after True, laser_warmup_ms 3000>
2024-05-07 17:53:00,719 [0x00002108] enlighten.device.Spectrometer INFO     change_device_setting[<DeviceID USB USB:0x24aa:0x1000:0:1>]: take_one_request -> TakeOneRequest <id 03916-08456-1715118780719668400-24385, avg 1, take_dark False, enable_laser_before True, disable_laser_after True, laser_warmup_ms 3000>
2024-05-07 17:53:00,719 [0x00002108] wasatch.WasatchDeviceWrapper DEBUG    change_setting: take_one_request => TakeOneRequest <id 03916-08456-1715118780719668400-24385, avg 1, take_dark False, enable_laser_before True, disable_laser_after True, laser_warmup_ms 3000>
2024-05-07 17:53:00,719 [0x00002108] enlighten.device.Multispec DEBUG    WP-01682 (WP-785-R-SR-ILP-25+SPL): app_state.take_one_request -> TakeOneRequest <id 03916-08456-1715118780719668400-24385, avg 1, take_dark False, enable_laser_before True, disable_laser_after True, laser_warmup_ms 3000>
2024-05-07 17:53:00,751 [0x00002108] wasatch.TakeOneRequest DEBUG    instantiated TakeOneRequest <id 03916-08456-1715118780751395400-21356, avg 1, take_dark False, enable_laser_before False, disable_laser_after False, laser_warmup_ms 0>
2024-05-07 17:53:00,751 [0x00002108] wasatch.TakeOneRequest DEBUG    --> via: File "Y:\code\ENLIGHTEN\scripts\Enlighten.py", line 262, in <module>
2024-05-07 17:53:00,751 [0x00002108] wasatch.TakeOneRequest DEBUG    --> via: File "Y:\code\ENLIGHTEN\scripts\Enlighten.py", line 248, in main
2024-05-07 17:53:00,751 [0x00002108] wasatch.TakeOneRequest DEBUG    --> via: File "Y:\code\ENLIGHTEN\scripts\Enlighten.py", line 166, in run
2024-05-07 17:53:00,751 [0x00002108] wasatch.TakeOneRequest DEBUG    --> via: File "Y:\code\ENLIGHTEN\enlighten\timing\BatchCollection.py", line 539, in tick_measurement
2024-05-07 17:53:00,751 [0x00002108] wasatch.TakeOneRequest DEBUG    --> via: File "Y:\code\ENLIGHTEN\enlighten\ui\VCRControls.py", line 227, in step_save
2024-05-07 17:53:00,751 [0x00002108] wasatch.TakeOneRequest DEBUG    --> via: File "Y:\code\ENLIGHTEN\enlighten\ui\VCRControls.py", line 215, in step
2024-05-07 17:53:00,751 [0x00002108] wasatch.TakeOneRequest DEBUG    --> via: File "Y:\code\ENLIGHTEN\enlighten\post_processing\TakeOneFeature.py", line 70, in start
    take_one_request = TakeOneRequest(scans_to_average=avg)
2024-05-07 17:53:00,751 [0x00002108] wasatch.TakeOneRequest DEBUG    --> via: File "y:\code\Wasatch.PY\wasatch\TakeOneRequest.py", line 21, in __init__
2024-05-07 17:53:00,751 [0x00002108] enlighten.device.Multispec DEBUG    WP-01682 (WP-785-R-SR-ILP-25+SPL): app_state.take_one_request -> TakeOneRequest <id 03916-08456-1715118780751395400-21356, avg 1, take_dark False, enable_laser_before False, disable_laser_after False, laser_warmup_ms 0>
mzieg commented 2 months ago

resolved in #398