Utils
pychilaslasers.utils
Classes
Constants
Constants used throughout the PyChilasLasers library.
CalibrationEntry(wavelength: float, phase_section: float, large_ring: float, small_ring: float, coupler: float, heater_values: Tuple[float, float, float, float], mode_index: int | None, cycler_index: int)
dataclass
Represents a single entry in the calibration data.
Functions
read_calibration_file(file_path: str | Path) -> dict
Utility function to read a calibration file of a laser.
Returns a calibration object which is a dictionary with the following structure: { "model": str, # The model of the laser "steady": { "current": float, # Default current for steady mode "tec_temp": float, # Default TEC temperature for steady mode "anti-hyst": tuple(voltages^2(list(float)),time_steps(list(float))), # anti-hyst values for steady mode "calibration": dict[wavelength(float) -> CalibrationEntry]
Due to how the tables are initialized the steady calibration dictionary does not contain
the entries with mode hop flags just the final entry for each wavelength.
This is fine for steady mode as those entries are not used in steady mode for
the COMET model. However, this means that the index of the wavelengths in list of keys of the
dictionary is not the same as it's cycler index.
},
"sweep": {
"current": float, # Default current for sweep mode
"tec_temp": float, # Default TEC temperature for sweep mode
"sweep_interval": int(micro-seconds), # Default sweep interval for sweep mode
"wavelengths": list(float), # List of wavelengths for sweep mode
This list contains duplicate entries for each wavelength that has a mode hop.
This is because the sweep mode uses the cycler index to set the wavelength,
which is based on the order of wavelengths in the list.
}
}
Source code in src/pychilaslasers/utils.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
|
list_comports() -> list[str]
Lists all available COM ports on the system.
serial.tools.list_ports.comports
is used to list all available
ports. In that regard this method is but a wrapper for it.
Returns:
-
list[str]
–List of available COM ports as strings sorted
-
list[str]
–alphabetically in ascending order.
Source code in src/pychilaslasers/utils.py
206 207 208 209 210 211 212 213 214 215 |
|