pylablib.devices.M2 package¶
Submodules¶
pylablib.devices.M2.solstis module¶
-
exception
pylablib.devices.M2.solstis.
M2Error
[source]¶ Bases:
pylablib.core.devio.base.DeviceError
Generic M2 error
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
pylablib.devices.M2.solstis.
M2CommunicationError
(exc)[source]¶ Bases:
pylablib.devices.M2.solstis.M2Error
,pylablib.core.devio.comm_backend.DeviceBackendError
M2 network communication error
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
class
pylablib.devices.M2.solstis.
Solstis
(addr, port, timeout=5.0, start_link=True, use_websocket='auto', use_cavity=True)[source]¶ Bases:
pylablib.core.devio.interface.IDevice
M2 Solstis Ice Bloc device.
Parameters: - addr (str) – IP address of the Ice Bloc device.
- port (int) – port of the Ice Bloc device.
- timeout (float) – default timeout of synchronous operations.
- start_link (bool) – if
True
, initialize device link on creation. - use_websocket (bool) – if
True
, use websocket interface (same as used by the web interface) for additional functionality (wavemeter connection, etalon value, improved operation stopping);"auto"
enables it if websocket package is installed, and disables otherwise - use_cavity – if
False
and any reference cavity methods are used, either ignore them, or use closest available methods instead
-
ReraiseError
¶ alias of
M2CommunicationError
-
BackendError
¶ alias of
builtins.OSError
-
query
(op, params, reply_op='auto', report=False)[source]¶ Send a query using the standard device interface.
reply_op is the name of the reply operation (by default, its the operation name plus
"_reply"
). Ifreport==True
, request completion report (does not apply to all operation).
-
wait_for_report
(op, error_msg=None, timeout=None)[source]¶ Wait for a report for the given operation
error_msg specifies the exception message if the report results in an error.
-
connect_wavemeter
(sync=True)[source]¶ Connect to the wavemeter (if
sync==True
, wait until the connection is established)
-
disconnect_wavemeter
(sync=True)[source]¶ Disconnect from the wavemeter (if
sync==True
, wait until the connection is broken)
-
get_full_web_status
()[source]¶ Get full websocket status.
Return a large dictionary containing all the information available in the web interface.
-
get_full_fine_tuning_status
()[source]¶ Get full fine-tuning status (see M2 Solstis JSON protocol manual for
"poll_wave_m"
command)
-
lock_wavemeter
(lock=True, sync=True, error_on_fail=True)[source]¶ Lock or unlock the laser to the wavemeter (if
sync==True
, wait until the operation is complete)
-
fine_tune_wavelength
(wavelength, sync=True, timeout=None)[source]¶ Fine-tune the wavelength.
Only works if the wavemeter is connected. If
sync==True
, wait until the operation is complete (might take from several seconds up to several minutes).
-
check_fine_tuning_report
()[source]¶ Check wavelength fine-tuning report
Return
"success"
or"fail"
if the operation is complete, orNone
if it is still in progress.
-
get_fine_tuning_status
()[source]¶ Get fine-tuning status.
Return either
"idle"
(no tuning or locking),"nolink"
(no wavemeter link),"tuning"
(tuning in progress), or"locked"
(tuned and locked to the wavemeter).
-
coarse_tune_wavelength
(wavelength, sync=True)[source]¶ Coarse-tune the wavelength.
Only works if the wavemeter is disconnected. If
sync==True
, wait until the operation is complete.
-
get_full_coarse_tuning_status
()[source]¶ Get full coarse-tuning status (see M2 M2 Solstis JSON protocol manual for
"poll_move_wave_t"
command)
-
get_coarse_tuning_status
()[source]¶ Get coarse-tuning status.
Return either
"done"
(tuning is done),"tuning"
(tuning in progress), or"fail"
(tuning failed).
-
get_coarse_wavelength
()[source]¶ Get course-tuned wavelength.
Only works if the wavemeter is disconnected.
-
tune_etalon
(value, sync=True)[source]¶ Tune the etalon to value percent.
Only works if the wavemeter is disconnected. If
sync==True
, wait until the operation is complete.
-
lock_etalon
(sync=True)[source]¶ Lock the etalon.
If
sync==True
, wait until the operation is complete.
-
unlock_etalon
(sync=True)[source]¶ Unlock the etalon .
If
sync==True
, wait until the operation is complete. Automatically unlock the reference cavity first (otherwise the operation fails).
-
get_etalon_lock_status
()[source]¶ Get etalon lock status.
Return either
"off"
(lock is off),"on"
(lock is on),"debug"
(lock in debug condition),"error"
(lock had an error),"search"
(lock is searching), or"low"
(lock is off due to low output).
-
tune_laser_resonator
(value, fine=False, sync=True)[source]¶ Tune the laser cavity to value percent.
If
fine==True
, adjust fine tuning; otherwise, adjust coarse tuning. Only works if the wavemeter is disconnected. Ifsync==True
, wait until the operation is complete.
-
tune_reference_cavity
(value, fine=False, sync=True)[source]¶ Tune the reference cavity to value percent.
If
fine==True
, adjust fine tuning; otherwise, adjust coarse tuning. Only works if the wavemeter is disconnected. Ifsync==True
, wait until the operation is complete. If reference cavity is disabled by settinguse_cavity=False
on creation, do nothing.
-
lock_reference_cavity
(sync=True)[source]¶ Lock the laser to the reference cavity.
Automatically lock etalon first (otherwise the operation fails). If
sync==True
, wait until the operation is complete. If reference cavity is disabled by settinguse_cavity=False
on creation, do nothing.
-
unlock_reference_cavity
(sync=True)[source]¶ Unlock the laser from the reference cavity.
If
sync==True
, wait until the operation is complete. If reference cavity is disabled by settinguse_cavity=False
on creation, do nothing.
-
get_reference_cavity_lock_status
()[source]¶ Get the reference cavity lock status.
Return either
"off"
(lock is off),"on"
(lock is on),"debug"
(lock in debug condition),"error"
(lock had an error),"search"
(lock is searching),"low"
(lock is off due to low output), or"disabled"
(reference cavity is disabled by settinguse_cavity=False
on creation).
-
setup_terascan
(scan_type, scan_range, rate, trunc_rate=True)[source]¶ Setup terascan.
Parameters: - scan_type (str) – scan type. Can be
"medium"
(BRF+etalon, rate from 100 GHz/s to 1 GHz/s),"fine"
(all elements, rate from 20 GHz/s to 1 MHz/s), or"line"
(all elements, rate from 20 GHz/s to 50 kHz/s). - scan_range (tuple) – tuple
(start, stop)
with the scan range (in Hz). - rate (float) – scan rate (in Hz/s).
- trunc_rate (bool) – if
True
, truncate the scan rate to the nearest available rate (otherwise, incorrect rate would raise an error).
If reference cavity is disabled by setting
use_cavity=False
on creation and scan_type is"line"
, use"fine"
instead.- scan_type (str) – scan type. Can be
-
start_terascan
(scan_type, sync=False, sync_done=False)[source]¶ Start terascan.
Scan parameters are set up separately using
setup_terascan()
. Scan type can be"medium"
(BRF+etalon, rate from 100 GHz/s to 1 GHz/s),"fine"
(all elements, rate from 20 GHz/s to 1 MHz/s), or"line"
(all elements, rate from 20 GHz/s to 50 kHz/s). If reference cavity is disabled by settinguse_cavity=False
on creation and scan_type is"line"
, use"fine"
instead. Ifsync==True
, wait until the scan is set up (not until the whole scan is complete). Ifsync_done==True
, wait until the whole scan is complete (not recommended, as it can take hours).
-
enable_terascan_updates
(enable=True, update_period=0)[source]¶ Enable sending periodic terascan updates.
If enabled, laser will send updates in the beginning and in the end of every terascan segment. If
update_period!=0
, it will also send updates everyupdate_period
percents of the segment (this option is not currently supported by M2 firmware).
-
check_terascan_update
()[source]¶ Check the latest terascan update.
Return
None
if none are available, or a dictionary{"wavelength":current_wavelength, "operation":op}
, whereop
is"scanning"
(scanning in progress),"stitching"
(stitching in progress),"finished"
(scan is finished), or"repeat"
(segment is repeated).
-
check_terascan_start_report
()[source]¶ Check report on terascan start.
Return
"success"
or"fail"
if the operation is complete, orNone
if it is still in progress.
-
stop_terascan
(scan_type, sync=False)[source]¶ Stop terascan of the given type.
If reference cavity is disabled by setting
use_cavity=False
on creation and scan_type is"line"
, use"fine"
instead. Ifsync==True
, wait until the operation is complete.
-
get_terascan_status
(scan_type, web_status=True)[source]¶ Get status of a terascan of a given type.
- Return a dictionary with 4 items:
"current"
: current laser frequency (orNone
if no scan is in progress)"range"
: tuple with the fill scan range (orNone
if no frequency is available)"status"
: can be"stopped"
(scan is not in progress),"scanning"
(scan is in progress), or"stitching"
(scan is in progress, but currently stitching)"web"
: whether scan is running in web interface (some failure modes still report"scanning"
through the usual interface); only available if the laser web connection is on and ifweb_status==True
.
If reference cavity is disabled by setting
use_cavity=False
on creation and scan_type is"line"
, use"fine"
instead.
-
start_fast_scan
(scan_type, width, period, sync=False, setup_locks=True)[source]¶ Setup and start fast scan.
Parameters: - scan_type (str) – scan type. Can be
"cavity_continuous"
,"cavity_single"
,"cavity_triangular"
,"etalon_continuous"
,"etalon_single"
,"resonator_continuous"
,"resonator_single"
,"resonator_ramp"
,"resonator_triangular"
,"ecd_continuous"
,"ecd_ramp"
, or"fringe_test"
(see M2 Solstis JSON protocol manual for details) - width (float) – scan width (in Hz).
- period (float) – scan time/period (in s).
- sync (bool) – if
True
, wait until the scan is set up (not until the whole scan is complete). - setup_locks (bool) – if
True
, automatically setup etalon and reference cavity locks in the appropriate states for etalon, cavity, or resonator scans.
If reference cavity is disabled by setting
use_cavity=False
on creation, use resonator scans instead of cavity scans.- scan_type (str) – scan type. Can be
-
check_fast_scan_start_report
()[source]¶ Check fast scan start report.
Return
"success"
or"fail"
if the operation is complete, orNone
if it is still in progress.
-
stop_fast_scan
(scan_type, return_to_start=True, sync=False)[source]¶ Stop fast scan of the given type.
If reference cavity is disabled by setting
use_cavity=False
on creation, use resonator scans instead of cavity scans. Ifreturn_to_start==True
, return to the center frequency after stopping; otherwise, stay at the current instantaneous frequency. Ifsync==True
, wait until the operation is complete.
-
get_fast_scan_status
(scan_type)[source]¶ Get status of a fast scan of a given type.
- Return dictionary with 2 items:
"status"
: can be"stopped"
(scan is not in progress),"scanning"
(scan is in progress)."value"
: current tuner value (in percent); does not necessary correspond to the scan progress.
If reference cavity is disabled by setting
use_cavity=False
on creation, use resonator scans instead of cavity scans.
-
stop_scan_web
(scan_type)[source]¶ Stop scan of the current type (terascan or fine scan) using web interface.
More reliable than native programming interface, but requires activated web interface. If reference cavity is disabled by setting
use_cavity=False
on creation, use resonator scans instead of cavity scans.
-
stop_all_operation
(repeated=True, attempt=0)[source]¶ Stop all laser operations (tuning and scanning).
More reliable than native programming interface, but requires activated web interface. If
repeated==True
, repeat trying to stop the operations until succeeded (more reliable, but takes more time). Ifattempt>0
, it can supply the number of already tried attempts to stop (withrepeated=False
); the more attempts failed, the more drastic measures will be taken to stop (e.g., initialize short terascan or a fast scan, cycle wavemeter connection, etc.) ReturnTrue
if the operation is success andFalse
otherwise.
-
class
NoParameterCaller
(device, kind)¶ Bases:
object
Class to simplify calling functions without a parameter
-
apply_settings
(settings)¶ Apply the settings.
settings is the dict
{name: value}
of the device available settings. Non-applicable settings are ignored.
-
get_device_variable
(key)¶ Get the value of a settings, status, or full info parameter
-
get_full_info
(include=0)¶ Get dict
{name: value}
containing full device information (including status and settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"
(all available variables). Since the lowest priority is -10, settinginclude=-10
queries all available variables, which is equivalent toinclude="all"
.
-
get_full_status
(include=0)¶ Get dict
{name: value}
containing the device status (including settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"
(all available variables). Since the lowest priority is -10, settinginclude=-10
queries all available variables, which is equivalent toinclude="all"
.
-
get_settings
(include=0)¶ Get dict
{name: value}
containing all the device settings.include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"
(all available variables). Since the lowest priority is -10, settinginclude=-10
queries all available variables, which is equivalent toinclude="all"
.
-
set_device_variable
(key, value)¶ Set the value of a settings parameter