27
27
clr .AddReference ("System.Collections" )
28
28
clr .AddReference ("System.IO" )
29
29
from System .Collections .Generic import List
30
- from System import String
30
+ from System import String , Int32 , Int64 , IntPtr , Double
31
31
from System .IO import FileAccess
32
32
except KeyError as e :
33
33
logger .error (f"KeyError { e } during import" )
@@ -83,11 +83,11 @@ def get(self, setting: Any) -> Any:
83
83
return value
84
84
85
85
def load_experiment (self , value : str ) -> None :
86
- self .experiment .Load (value )
86
+ self .experiment .Load (String ( value ) )
87
87
self .set (lf .AddIns .ExperimentSettings .FileNameGenerationAttachDate , False )
88
88
self .set (lf .AddIns .ExperimentSettings .FileNameGenerationAttachTime , False )
89
89
self .set (lf .AddIns .ExperimentSettings .FileNameGenerationAttachIncrement , True )
90
- self .set (lf .AddIns .ExperimentSettings .FileNameGenerationIncrementNumber , 0 )
90
+ self .set (lf .AddIns .ExperimentSettings .FileNameGenerationIncrementNumber , Int32 ( 0 ) )
91
91
92
92
def file_setup (self ) -> None :
93
93
self .set (lf .AddIns .ExperimentSettings .FileNameGenerationBaseFileName , str (uuid .uuid4 ()))
@@ -211,7 +211,7 @@ def center_wavelength(self, nanometers: float) -> None:
211
211
"""
212
212
# The line below addresses bug where if step and glue is enabled it wont allow you to set the center wavelength.
213
213
self .light .set (lf .AddIns .ExperimentSettings .StepAndGlueEnabled , False )
214
- self .light .set (lf .AddIns .SpectrometerSettings .GratingCenterWavelength , nanometers )
214
+ self .light .set (lf .AddIns .SpectrometerSettings .GratingCenterWavelength , Double ( nanometers ) )
215
215
216
216
@property
217
217
def experiment_name (self ) -> Union [str , None ]:
@@ -246,7 +246,7 @@ def grating(self, value: str) -> None:
246
246
Sets the current grating to be the one specified by parameter grating.
247
247
"""
248
248
if value in self .grating_options :
249
- self .light .set (lf .AddIns .SpectrometerSettings .GratingSelected , value )
249
+ self .light .set (lf .AddIns .SpectrometerSettings .GratingSelected , String ( value ) )
250
250
else :
251
251
logger .error (f"Grating { value } is not an options. The options are: { self .grating_options } " )
252
252
@@ -271,7 +271,7 @@ def num_frames(self, num_frames: int) -> None:
271
271
"""
272
272
Sets the number of frames to be taken during acquisition to number.
273
273
"""
274
- self .light .set (lf .AddIns .ExperimentSettings .AcquisitionFramesToStore , num_frames )
274
+ self .light .set (lf .AddIns .ExperimentSettings .AcquisitionFramesToStore , Int64 ( num_frames ) )
275
275
276
276
@property
277
277
def exposure_time (self ) -> float :
@@ -285,7 +285,7 @@ def exposure_time(self, ms: float) -> None:
285
285
"""
286
286
Sets the single frame exposure time to be ms (in ms).
287
287
"""
288
- self .light .set (lf .AddIns .CameraSettings .ShutterTimingExposureTime , ms )
288
+ self .light .set (lf .AddIns .CameraSettings .ShutterTimingExposureTime , Double ( ms ) )
289
289
290
290
@property
291
291
def temperature_sensor_setpoint (self ) -> float :
@@ -302,7 +302,7 @@ def temperature_sensor_setpoint(self, deg_C: float) -> None:
302
302
The `temperature_sensor_setpoint` defines a target or reference value for the camera's sensor, ensuring optimal or specific operation conditions for image acquisition.
303
303
Depending on the setpoint, the behavior or response of the camera sensor might vary.
304
304
"""
305
- self .light .set (lf .AddIns .CameraSettings .SensorTemperatureSetPoint , deg_C )
305
+ self .light .set (lf .AddIns .CameraSettings .SensorTemperatureSetPoint , Double ( deg_C ) )
306
306
307
307
class SpectrometerDataAcquisition (SpectrometerConfig ):
308
308
def acquire_frame (self ) -> Tuple [np .ndarray , np .ndarray ]:
@@ -332,8 +332,8 @@ def acquire_step_and_glue(self, wavelength_range: Tuple[float, float]) -> Tuple[
332
332
self .light .set (lf .AddIns .ExperimentSettings .StepAndGlueEnabled , False )
333
333
logger .error (f'Unable to perform step and glue due to error: { e } ' )
334
334
335
- self .light .set (lf .AddIns .ExperimentSettings .StepAndGlueStartingWavelength , lambda_min )
336
- self .light .set (lf .AddIns .ExperimentSettings .StepAndGlueEndingWavelength , lambda_max )
335
+ self .light .set (lf .AddIns .ExperimentSettings .StepAndGlueStartingWavelength , Double ( lambda_min ) )
336
+ self .light .set (lf .AddIns .ExperimentSettings .StepAndGlueEndingWavelength , Double ( lambda_max ) )
337
337
338
338
if lambda_max - lambda_min < self .MIN_WAVELENGTH_DIFFERENCE :
339
339
raise ValueError (f"End wavelength must be atleast { self .MIN_WAVELENGTH_DIFFERENCE } units greater than the start wavelength." )
0 commit comments