diff --git a/brukeropus/file/file.py b/brukeropus/file/file.py index ac678d0..3d70fa4 100644 --- a/brukeropus/file/file.py +++ b/brukeropus/file/file.py @@ -161,9 +161,10 @@ class FileBlockInfo: start: pointer to start location of the block within the file keys: tuple of three char keys contained in parameter blocks. This attribute is set by the OPUSFile class only when the block is parameter block. This enables grouping parameters by block if desired. + bytes: raw bytes of file block (currently only set for unknown blocks) ''' - __slots__ = ('type', 'size', 'start', 'keys') + __slots__ = ('type', 'size', 'start', 'keys', 'bytes') keys: tuple @@ -176,10 +177,6 @@ def __str__(self): label = self.get_label() return 'Block Info: ' + label + ' (size: ' + str(self.size) + ' bytes; start: ' + str(self.start) + ')' - def is_valid(self): - '''Returns False if FileBlockInfo is undefined (i.e. FileBlockInfo.type == (0, 0, 0, 0, 0, 0))''' - return self.type != (0, 0, 0, 0, 0, 0) - def is_data_status(self): '''Returns True if FileBlockInfo is a data status parameter block''' return self.type[2] == 1 @@ -190,7 +187,7 @@ def is_rf_param(self): def is_param(self): '''Returns True if FileBlockInfo is a parameter block''' - return self.type[2] > 1 + return self.type[2] > 1 or self.type == (0, 0, 0, 0, 0, 1) def is_directory(self): '''Returns True if FileBlockInfo is the directory block''' @@ -202,7 +199,7 @@ def is_file_log(self): def is_data(self): '''Returns True if FileBlockInfo is a data block or 3D data block''' - return self.type[2] == 0 and self.type[3] > 0 and self.type[3] != 13 + return self.type[0] > 0 and self.type[1] > 0 and self.type[2] == 0 and self.type[3] > 0 def is_3d_data(self): '''Returns True if FileBlockInfo is a 3D data block (i.e. data series)''' @@ -466,10 +463,12 @@ class FileDirectory: file_log_block: `FileBlockInfo` of the file log (changes, etc.) data_and_status_block_pairs: (data: `FileBlockInfo`, data_status: `FileBlockInfo`) which pairs the data status parameter block (time, x units, y units, etc.) with the data block it informs + unknown_blocks: list of `FileBlockInfo` with an unrecognized type (i.e. not sure how to parse) ''' __slots__ = ('version', 'start', 'max_blocks', 'num_blocks', 'data_blocks', 'data_status_blocks', 'param_blocks', - 'rf_param_blocks', 'directory_block', 'file_log_block', 'data_and_status_block_pairs') + 'rf_param_blocks', 'directory_block', 'file_log_block', 'data_and_status_block_pairs', + 'unknown_blocks') def __init__(self, filebytes: bytes): self.version, self.start, self.max_blocks, self.num_blocks = parse_header(filebytes) @@ -479,6 +478,7 @@ def __init__(self, filebytes: bytes): self.rf_param_blocks: list = [] self.directory_block: FileBlockInfo self.file_log_block: FileBlockInfo + self.unknown_blocks: list = [] for block_type, size, start in parse_directory(filebytes, self.start, self.num_blocks): block = FileBlockInfo(block_type=block_type, size=size, start=start) if block.is_data_status(): @@ -491,8 +491,11 @@ def __init__(self, filebytes: bytes): self.directory_block = block elif block.is_file_log(): self.file_log_block = block - elif block.is_valid(): + elif block.is_data(): self.data_blocks.append(block) + else: + block.bytes = filebytes[block.start:block.start + block.size] + self.unknown_blocks.append(block) self.data_and_status_block_pairs = [] self._pair_data_and_status_blocks() diff --git a/brukeropus/file/utils.py b/brukeropus/file/utils.py index a5965e2..54e218a 100644 --- a/brukeropus/file/utils.py +++ b/brukeropus/file/utils.py @@ -199,7 +199,7 @@ def _parse_block_and_print(filebytes, block_info, width): param_col_labels = ('Key', 'Friendly Name', 'Value') if block_info[0] != (0, 0, 0, 13, 0, 0): _print_block_header(get_block_type_label(block_info[0]), width) - if block_info[0][2] > 0: + if block_info[0][2] > 0 or block_info[0] == (0, 0, 0, 0, 0, 1): _print_cols(param_col_labels, param_col_widths) for key, val in parse_param_block(filebytes, block_info[1], block_info[2]): _print_cols((key, get_param_label(key), val), param_col_widths) @@ -213,12 +213,12 @@ def _parse_block_and_print(filebytes, block_info, width): _print_centered('Num Blocks: ' + str(data['num_blocks']), width) _print_centered('Store Table: ' + str(data['store_table']), width) print(data['y']) - elif block_info[0] == (0, 0, 0, 0, 0, 0): - _print_centered('Undefined Block Type: Raw Bytes', width) - print(filebytes[block_info[1]: block_info[1] + block_info[2]]) - else: + elif block_info[0][0] > 0 and block_info[0][1] > 0 and block_info[0][2] == 0 and block_info[0][3] > 0: array = parse_data_block(filebytes, block_info[1], block_info[2]) print(array) + else: + _print_centered('Undefined Block Type: Raw Bytes', width) + print(filebytes[block_info[2]: block_info[2] + block_info[1]]) def _print_cols(vals, col_widths,): diff --git a/docs/brukeropus/control/dde.html b/docs/brukeropus/control/dde.html index 55d1a20..fcc43e7 100644 --- a/docs/brukeropus/control/dde.html +++ b/docs/brukeropus/control/dde.html @@ -1365,7 +1365,11 @@

def +<<<<<<< HEAD get_winfunc( libname, funcname, restype=None, argtypes=(), _libcache={'user32': <WinDLL 'user32', handle 7fffa9710000>}): +======= + get_winfunc( libname, funcname, restype=None, argtypes=(), _libcache={'user32': <WinDLL 'user32', handle 7fff631d0000>}): +>>>>>>> origin/master diff --git a/docs/brukeropus/file/file.html b/docs/brukeropus/file/file.html index cfd1328..7989fe0 100644 --- a/docs/brukeropus/file/file.html +++ b/docs/brukeropus/file/file.html @@ -69,9 +69,6 @@

API Documentation

  • start
  • -
  • - is_valid -
  • is_data_status
  • @@ -102,6 +99,9 @@

    API Documentation

  • get_data_key
  • +
  • + bytes +
  • @@ -198,6 +198,9 @@

    API Documentation

  • file_log_block
  • +
  • + unknown_blocks +
  • data_and_status_block_pairs
  • @@ -400,248 +403,249 @@

    161 start: pointer to start location of the block within the file 162 keys: tuple of three char keys contained in parameter blocks. This attribute is set by the OPUSFile class only 163 when the block is parameter block. This enables grouping parameters by block if desired. -164 ''' -165 -166 __slots__ = ('type', 'size', 'start', 'keys') -167 -168 keys: tuple -169 -170 def __init__(self, block_type: tuple, size: int, start: int): -171 self.type = block_type -172 self.size = size -173 self.start = start -174 -175 def __str__(self): -176 label = self.get_label() -177 return 'Block Info: ' + label + ' (size: ' + str(self.size) + ' bytes; start: ' + str(self.start) + ')' -178 -179 def is_valid(self): -180 '''Returns False if FileBlockInfo is undefined (i.e. FileBlockInfo.type == (0, 0, 0, 0, 0, 0))''' -181 return self.type != (0, 0, 0, 0, 0, 0) -182 -183 def is_data_status(self): -184 '''Returns True if FileBlockInfo is a data status parameter block''' -185 return self.type[2] == 1 -186 -187 def is_rf_param(self): -188 '''Returns True if FileBlockInfo is a parameter block associated with the reference measurement''' -189 return self.type[2] > 1 and self.type[1] == 2 -190 -191 def is_param(self): -192 '''Returns True if FileBlockInfo is a parameter block''' -193 return self.type[2] > 1 -194 -195 def is_directory(self): -196 '''Returns True if FileBlockInfo is the directory block''' -197 return self.type == (0, 0, 0, 13, 0, 0) -198 -199 def is_file_log(self): -200 '''Returns True if FileBlockInfo is the file log block''' -201 return self.type == (0, 0, 0, 0, 0, 5) -202 -203 def is_data(self): -204 '''Returns True if FileBlockInfo is a data block or 3D data block''' -205 return self.type[2] == 0 and self.type[3] > 0 and self.type[3] != 13 -206 -207 def is_3d_data(self): -208 '''Returns True if FileBlockInfo is a 3D data block (i.e. data series)''' -209 return self.is_data() and self.type[5] == 2 +164 bytes: raw bytes of file block (currently only set for unknown blocks) +165 ''' +166 +167 __slots__ = ('type', 'size', 'start', 'keys', 'bytes') +168 +169 keys: tuple +170 +171 def __init__(self, block_type: tuple, size: int, start: int): +172 self.type = block_type +173 self.size = size +174 self.start = start +175 +176 def __str__(self): +177 label = self.get_label() +178 return 'Block Info: ' + label + ' (size: ' + str(self.size) + ' bytes; start: ' + str(self.start) + ')' +179 +180 def is_data_status(self): +181 '''Returns True if FileBlockInfo is a data status parameter block''' +182 return self.type[2] == 1 +183 +184 def is_rf_param(self): +185 '''Returns True if FileBlockInfo is a parameter block associated with the reference measurement''' +186 return self.type[2] > 1 and self.type[1] == 2 +187 +188 def is_param(self): +189 '''Returns True if FileBlockInfo is a parameter block''' +190 return self.type[2] > 1 or self.type == (0, 0, 0, 0, 0, 1) +191 +192 def is_directory(self): +193 '''Returns True if FileBlockInfo is the directory block''' +194 return self.type == (0, 0, 0, 13, 0, 0) +195 +196 def is_file_log(self): +197 '''Returns True if FileBlockInfo is the file log block''' +198 return self.type == (0, 0, 0, 0, 0, 5) +199 +200 def is_data(self): +201 '''Returns True if FileBlockInfo is a data block or 3D data block''' +202 return self.type[0] > 0 and self.type[1] > 0 and self.type[2] == 0 and self.type[3] > 0 +203 +204 def is_3d_data(self): +205 '''Returns True if FileBlockInfo is a 3D data block (i.e. data series)''' +206 return self.is_data() and self.type[5] == 2 +207 +208 def is_data_status_match(self, data_block_info): +209 '''Returns True if FileBlockInfo is a data status block and a match to the data_block_info argument. 210 -211 def is_data_status_match(self, data_block_info): -212 '''Returns True if FileBlockInfo is a data status block and a match to the data_block_info argument. +211 This function is used to match a data status block (contains metadata for data block) with its associated data +212 block (contains array data). 213 -214 This function is used to match a data status block (contains metadata for data block) with its associated data -215 block (contains array data). +214 Args: +215 data_block_info (FileBlockInfo): data block being tested as a match. 216 -217 Args: -218 data_block_info (FileBlockInfo): data block being tested as a match. -219 -220 Returns: -221 is_match (bool): True if FileBlockInfo is data status block and input argument is matching data block''' -222 if self.is_data_status(): -223 return data_block_info.type[:2] == self.type[:2] and data_block_info.type[3:] == self.type[3:] -224 -225 def get_label(self): -226 '''Returns a friendly string label that describes the block type''' -227 return get_block_type_label(self.type) +217 Returns: +218 is_match (bool): True if FileBlockInfo is data status block and input argument is matching data block''' +219 if self.is_data_status(): +220 return data_block_info.type[:2] == self.type[:2] and data_block_info.type[3:] == self.type[3:] +221 +222 def get_label(self): +223 '''Returns a friendly string label that describes the block type''' +224 return get_block_type_label(self.type) +225 +226 def get_data_key(self): +227 '''If block is a data block, this function will return an shorthand key to reference that data. 228 -229 def get_data_key(self): -230 '''If block is a data block, this function will return an shorthand key to reference that data. -231 -232 e.g. t: transmission, a: absorption, sm: sample, rf: reference, smph: sample phase etc. If the block is not -233 a data block, it will return None.''' -234 if self.is_data(): -235 return get_data_key(self.type) -236 else: -237 return None -238 +229 e.g. t: transmission, a: absorption, sm: sample, rf: reference, smph: sample phase etc. If the block is not +230 a data block, it will return None.''' +231 if self.is_data(): +232 return get_data_key(self.type) +233 else: +234 return None +235 +236 +237class Data: +238 '''Class containing array data and associated parameter/metadata from an OPUS file. 239 -240class Data: -241 '''Class containing array data and associated parameter/metadata from an OPUS file. -242 -243 Args: -244 filebytes: raw bytes from OPUS file. see: `read_opus_file_bytes` -245 data_info: `FileBlockInfo` instance of a data block -246 data_status_info: `FileBlockInfo` instance of a data status block which contains metadata about the data_info -247 block. This block is a parameter block. -248 -249 Attributes: -250 params: `Parameter` class with metadata associated with the data block such as first x point: `fxp`, last x -251 point: `lxp`, number of points: `npt`, date: `dat`, time: `tim` etc. -252 y: 1D `numpy` array containing y values of data block -253 x: 1D `numpy` array containing x values of data block. Units of x array are given by `dxu` parameter. -254 label: human-readable string label describing the data block (e.g. Sample Spectrum, Absorbance, etc.) -255 -256 Extended Attributes: -257 **wn:** Returns the x array in wavenumber (cm⁻¹) units regardless of what units the x array was originally +240 Args: +241 filebytes: raw bytes from OPUS file. see: `read_opus_file_bytes` +242 data_info: `FileBlockInfo` instance of a data block +243 data_status_info: `FileBlockInfo` instance of a data status block which contains metadata about the data_info +244 block. This block is a parameter block. +245 +246 Attributes: +247 params: `Parameter` class with metadata associated with the data block such as first x point: `fxp`, last x +248 point: `lxp`, number of points: `npt`, date: `dat`, time: `tim` etc. +249 y: 1D `numpy` array containing y values of data block +250 x: 1D `numpy` array containing x values of data block. Units of x array are given by `dxu` parameter. +251 label: human-readable string label describing the data block (e.g. Sample Spectrum, Absorbance, etc.) +252 +253 Extended Attributes: +254 **wn:** Returns the x array in wavenumber (cm⁻¹) units regardless of what units the x array was originally +255 saved in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not +256 interferogram or phase blocks. +257 **wl:** Returns the x array in wavelength (µm) units regardless of what units the x array was originally 258 saved in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not 259 interferogram or phase blocks. -260 **wl:** Returns the x array in wavelength (µm) units regardless of what units the x array was originally -261 saved in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not -262 interferogram or phase blocks. -263 **f:** Returns the x array in modulation frequency units (Hz) regardless of what units the x array was -264 originally saved in. This is only valid for spectral data blocks such as sample, reference, transmission, -265 etc., not interferogram or phase blocks. -266 **datetime:** Returns a `datetime` class of when the data was taken (extracted from data status parameter block). -267 **xxx:** the various three char parameter keys from the `params` attribute can be directly called from the -268 `Data` class for convenience. Common parameters include `dxu` (x units), `mxy` (max y value), `mny` (min y -269 value), etc. -270 ''' -271 __slots__ = ('_key', 'params', 'y', 'x', 'label', 'vel') -272 -273 def __init__(self, filebytes: bytes, data_info: FileBlockInfo, data_status_info: FileBlockInfo): -274 self._key = data_info.get_data_key() -275 self.params = Parameters(filebytes, [data_status_info]) -276 y = parse_data_block(filebytes, size=data_info.size, start=data_info.start, dpf=self.params.dpf) -277 self.y = y[:self.params.npt] # Trim extra values on some spectra -278 self.x = np.linspace(self.params.fxv, self.params.lxv, self.params.npt) -279 self.label = data_info.get_label() -280 self.vel = 0 -281 -282 def __getattr__(self, name): -283 if name.lower() == 'wn' and self.params.dxu in ('WN', 'MI', 'LGW'): -284 return self._get_wn() -285 elif name.lower() == 'wl' and self.params.dxu in ('WN', 'MI', 'LGW'): -286 return self._get_wl() -287 elif name.lower() == 'f' and self.params.dxu in ('WN', 'MI', 'LGW'): -288 return self._get_freq() -289 elif name.lower() in self.params.keys(): -290 return getattr(self.params, name.lower()) -291 elif name == 'datetime': -292 return self.params.datetime -293 else: -294 text = str(name) + ' is not a valid attribute for Data: ' + str(self._key) -295 raise AttributeError(text) -296 -297 def _get_wn(self): -298 if self.params.dxu == 'WN': -299 return self.x -300 elif self.params.dxu == 'MI': -301 return 10000. / self.x -302 elif self.params.dxu == 'LGW': -303 return np.exp(self.x) -304 -305 def _get_wl(self): -306 if self.params.dxu == 'WN': -307 return 10000. / self.x -308 elif self.params.dxu == 'MI': -309 return self.x -310 elif self.params.dxu == 'LGW': -311 return 10000 / np.exp(self.x) -312 -313 def _get_freq(self): -314 vel = 1000 * np.float(self.vel) / 7900 # cm/s -315 return vel * self.wn -316 +260 **f:** Returns the x array in modulation frequency units (Hz) regardless of what units the x array was +261 originally saved in. This is only valid for spectral data blocks such as sample, reference, transmission, +262 etc., not interferogram or phase blocks. +263 **datetime:** Returns a `datetime` class of when the data was taken (extracted from data status parameter block). +264 **xxx:** the various three char parameter keys from the `params` attribute can be directly called from the +265 `Data` class for convenience. Common parameters include `dxu` (x units), `mxy` (max y value), `mny` (min y +266 value), etc. +267 ''' +268 __slots__ = ('_key', 'params', 'y', 'x', 'label', 'vel') +269 +270 def __init__(self, filebytes: bytes, data_info: FileBlockInfo, data_status_info: FileBlockInfo): +271 self._key = data_info.get_data_key() +272 self.params = Parameters(filebytes, [data_status_info]) +273 y = parse_data_block(filebytes, size=data_info.size, start=data_info.start, dpf=self.params.dpf) +274 self.y = y[:self.params.npt] # Trim extra values on some spectra +275 self.x = np.linspace(self.params.fxv, self.params.lxv, self.params.npt) +276 self.label = data_info.get_label() +277 self.vel = 0 +278 +279 def __getattr__(self, name): +280 if name.lower() == 'wn' and self.params.dxu in ('WN', 'MI', 'LGW'): +281 return self._get_wn() +282 elif name.lower() == 'wl' and self.params.dxu in ('WN', 'MI', 'LGW'): +283 return self._get_wl() +284 elif name.lower() == 'f' and self.params.dxu in ('WN', 'MI', 'LGW'): +285 return self._get_freq() +286 elif name.lower() in self.params.keys(): +287 return getattr(self.params, name.lower()) +288 elif name == 'datetime': +289 return self.params.datetime +290 else: +291 text = str(name) + ' is not a valid attribute for Data: ' + str(self._key) +292 raise AttributeError(text) +293 +294 def _get_wn(self): +295 if self.params.dxu == 'WN': +296 return self.x +297 elif self.params.dxu == 'MI': +298 return 10000. / self.x +299 elif self.params.dxu == 'LGW': +300 return np.exp(self.x) +301 +302 def _get_wl(self): +303 if self.params.dxu == 'WN': +304 return 10000. / self.x +305 elif self.params.dxu == 'MI': +306 return self.x +307 elif self.params.dxu == 'LGW': +308 return 10000 / np.exp(self.x) +309 +310 def _get_freq(self): +311 vel = 1000 * np.float(self.vel) / 7900 # cm/s +312 return vel * self.wn +313 +314 +315class Data3D(Data): +316 '''Class containing 3D array data (series of spectra) and associated parameter/metadata from an OPUS file. 317 -318class Data3D(Data): -319 '''Class containing 3D array data (series of spectra) and associated parameter/metadata from an OPUS file. -320 -321 Args: -322 filebytes: raw bytes from OPUS file. see: read_opus_file_bytes -323 data_info: FileBlockInfo instance of a 3D data block -324 data_status_info: FileBlockInfo instance of a data status block which contains metadata about the data_info -325 block. This block is a parameter block. -326 -327 Attributes: -328 params: Parameter class with metadata associated with the data block such as first x point (fxp), last x point -329 (lxp), number of points (npt), date (dat), time (tim) etc. -330 y: 2D numpy array containing y values of data block -331 x: 1D numpy array containing x values of data block. Units of x array are given by .dxu attribute. -332 num_spectra: number of spectra in the series (i.e. length of y) -333 label: human-readable string label describing the data block (e.g. Sample Spectrum, Absorbance, etc.) -334 -335 Extended Attributes: -336 **wn:** Returns the x array in wavenumber (cm⁻¹) units regardless of what units the x array was originally saved +318 Args: +319 filebytes: raw bytes from OPUS file. see: read_opus_file_bytes +320 data_info: FileBlockInfo instance of a 3D data block +321 data_status_info: FileBlockInfo instance of a data status block which contains metadata about the data_info +322 block. This block is a parameter block. +323 +324 Attributes: +325 params: Parameter class with metadata associated with the data block such as first x point (fxp), last x point +326 (lxp), number of points (npt), date (dat), time (tim) etc. +327 y: 2D numpy array containing y values of data block +328 x: 1D numpy array containing x values of data block. Units of x array are given by .dxu attribute. +329 num_spectra: number of spectra in the series (i.e. length of y) +330 label: human-readable string label describing the data block (e.g. Sample Spectrum, Absorbance, etc.) +331 +332 Extended Attributes: +333 **wn:** Returns the x array in wavenumber (cm⁻¹) units regardless of what units the x array was originally saved +334 in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not +335 interferogram or phase blocks. +336 **wl:** Returns the x array in wavelength (µm) units regardless of what units the x array was originally saved 337 in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not 338 interferogram or phase blocks. -339 **wl:** Returns the x array in wavelength (µm) units regardless of what units the x array was originally saved -340 in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not -341 interferogram or phase blocks. -342 **datetime:** Returns a `datetime` class of when the data was taken (extracted from data status parameter -343 block). -344 **xxx:** the various three char parameter keys from the "params" attribute can be directly called from the data -345 class for convenience. Several of these parameters return arrays, rather than singular values because they -346 are recorded for every spectra in the series, e.g. `npt`, `mny`, `mxy`, `tim`, `nsn`. -347 ''' -348 __slots__ = ('_key', 'params', 'y', 'x', 'num_spectra', 'label') -349 -350 def __init__(self, filebytes: bytes, data_info: FileBlockInfo, data_status_info: FileBlockInfo): -351 self._key = data_info.get_data_key() -352 self.params = Parameters(filebytes, [data_status_info]) -353 data = parse_3d_data_block(filebytes, start=data_info.start, dpf=self.params.dpf) -354 self.y = data['y'][:, :self.params.npt] # Trim extra values on some spectra -355 self.x = np.linspace(self.params.fxv, self.params.lxv, self.params.npt) -356 self.num_spectra = data['num_blocks'] -357 for key, val in data.items(): -358 if key not in ['y', 'version', 'offset', 'num_blocks', 'data_size', 'info_size']: -359 self.params._params[key] = val -360 self.label = data_info.get_label() -361 +339 **datetime:** Returns a `datetime` class of when the data was taken (extracted from data status parameter +340 block). +341 **xxx:** the various three char parameter keys from the "params" attribute can be directly called from the data +342 class for convenience. Several of these parameters return arrays, rather than singular values because they +343 are recorded for every spectra in the series, e.g. `npt`, `mny`, `mxy`, `tim`, `nsn`. +344 ''' +345 __slots__ = ('_key', 'params', 'y', 'x', 'num_spectra', 'label') +346 +347 def __init__(self, filebytes: bytes, data_info: FileBlockInfo, data_status_info: FileBlockInfo): +348 self._key = data_info.get_data_key() +349 self.params = Parameters(filebytes, [data_status_info]) +350 data = parse_3d_data_block(filebytes, start=data_info.start, dpf=self.params.dpf) +351 self.y = data['y'][:, :self.params.npt] # Trim extra values on some spectra +352 self.x = np.linspace(self.params.fxv, self.params.lxv, self.params.npt) +353 self.num_spectra = data['num_blocks'] +354 for key, val in data.items(): +355 if key not in ['y', 'version', 'offset', 'num_blocks', 'data_size', 'info_size']: +356 self.params._params[key] = val +357 self.label = data_info.get_label() +358 +359 +360class Parameters: +361 '''Class containing parameter metadata of an OPUS file. 362 -363class Parameters: -364 '''Class containing parameter metadata of an OPUS file. -365 -366 Parameters of an OPUS file are stored as key, val pairs, where the key is always three chars. For example, the -367 beamsplitter is stored in the "bms" attribute, source in "src" etc. A list of known keys, with friendly label can -368 be found in `brukeropus.file.constants.PARAM_LABELS`. The keys in an OPUS file are not case sensitive, and stored -369 in all CAPS (i.e. `BMS`, `SRC`, etc.) but this class uses lower case keys to follow python convention. The class is -370 initialized from a list of parameter `FileBlockInfo`. The key, val items in blocks of the list are combined into -371 one parameter class, so care must be taken not to pass blocks that will overwrite each others keys. Analagous to a -372 dict, the keys, values, and (key, val) can be iterated over using the functions: `keys()`, `values()`, and `items()` -373 respectively. -374 -375 Args: -376 filebytes: raw bytes from OPUS file. see: `brukeropus.file.parser.read_opus_file_bytes` -377 param_blocks: list of `FileBlockInfo`; every block in the list should be classified as a parameter block. -378 -379 Attributes: -380 xxx: parameter attributes are stored as three char keys. Which keys are generated depends on the list of -381 `FileBlockInfo` that is used to initialize the class. If input list contains a single data status -382 `FileBlockInfo`, attributes will include: `fxv`, `lxv`, `npt` (first x-val, last x-val, number of points), -383 etc. Other blocks produce attributes such as: `bms`, `src`, `apt` (beamsplitter, source, aperture) etc. A -384 full list of keys available in a given Parameters instance are given by the `keys()` method. -385 datetime: if blocks contain the keys: `dat` (date) and `tim` (time), the `datetime` attribute of this class will -386 be set to a python `datetime` object. Currently, only data status blocks are known to have these keys. If -387 `dat` and `tim` are not present in the class, the `datetime` attribute will return `None`. -388 ''' -389 __slots__ = ('_params', 'datetime') -390 -391 def __init__(self, filebytes: bytes, param_blocks: list): -392 self._params = dict() -393 for block_info in param_blocks: -394 params = {key.lower(): val for key, val in parse_param_block(filebytes, block_info.size, block_info.start)} -395 self._params.update(params) -396 block_info.keys = tuple(params.keys()) -397 self._set_datetime() -398 -399 def __getattr__(self, name): -400 if name.lower() in self._params.keys(): -401 return self._params[name.lower()] -402 else: -403 text = str(name) + ' not a valid attribute. For list of valid parameter keys, use: .keys()' -404 raise AttributeError(text) +363 Parameters of an OPUS file are stored as key, val pairs, where the key is always three chars. For example, the +364 beamsplitter is stored in the "bms" attribute, source in "src" etc. A list of known keys, with friendly label can +365 be found in `brukeropus.file.constants.PARAM_LABELS`. The keys in an OPUS file are not case sensitive, and stored +366 in all CAPS (i.e. `BMS`, `SRC`, etc.) but this class uses lower case keys to follow python convention. The class is +367 initialized from a list of parameter `FileBlockInfo`. The key, val items in blocks of the list are combined into +368 one parameter class, so care must be taken not to pass blocks that will overwrite each others keys. Analagous to a +369 dict, the keys, values, and (key, val) can be iterated over using the functions: `keys()`, `values()`, and `items()` +370 respectively. +371 +372 Args: +373 filebytes: raw bytes from OPUS file. see: `brukeropus.file.parser.read_opus_file_bytes` +374 param_blocks: list of `FileBlockInfo`; every block in the list should be classified as a parameter block. +375 +376 Attributes: +377 xxx: parameter attributes are stored as three char keys. Which keys are generated depends on the list of +378 `FileBlockInfo` that is used to initialize the class. If input list contains a single data status +379 `FileBlockInfo`, attributes will include: `fxv`, `lxv`, `npt` (first x-val, last x-val, number of points), +380 etc. Other blocks produce attributes such as: `bms`, `src`, `apt` (beamsplitter, source, aperture) etc. A +381 full list of keys available in a given Parameters instance are given by the `keys()` method. +382 datetime: if blocks contain the keys: `dat` (date) and `tim` (time), the `datetime` attribute of this class will +383 be set to a python `datetime` object. Currently, only data status blocks are known to have these keys. If +384 `dat` and `tim` are not present in the class, the `datetime` attribute will return `None`. +385 ''' +386 __slots__ = ('_params', 'datetime') +387 +388 def __init__(self, filebytes: bytes, param_blocks: list): +389 self._params = dict() +390 for block_info in param_blocks: +391 params = {key.lower(): val for key, val in parse_param_block(filebytes, block_info.size, block_info.start)} +392 self._params.update(params) +393 block_info.keys = tuple(params.keys()) +394 self._set_datetime() +395 +396 def __getattr__(self, name): +397 if name.lower() in self._params.keys(): +398 return self._params[name.lower()] +399 else: +400 text = str(name) + ' not a valid attribute. For list of valid parameter keys, use: .keys()' +401 raise AttributeError(text) +402 +403 def __getitem__(self, item): +404 return self._params.__getitem__(item) 405 +<<<<<<< HEAD 406 def __getitem__(self, item): 407 return self._params.__getitem__(item) 408 @@ -718,6 +722,84 @@

    479 self.rf_param_blocks: list = [] 480 self.directory_block: FileBlockInfo 481 self.file_log_block: FileBlockInfo +======= +406 def _set_datetime(self): +407 if 'dat' in self.keys() and 'tim' in self.keys(): +408 try: +409 date_str = self.dat +410 time_str = self.tim +411 dt_str = date_str + '-' + time_str[:time_str.index(' (')] +412 try: +413 fmt = '%d/%m/%Y-%H:%M:%S.%f' +414 dt = datetime.datetime.strptime(dt_str, fmt) +415 except: +416 try: +417 fmt = '%Y/%m/%d-%H:%M:%S.%f' +418 dt = datetime.datetime.strptime(dt_str, fmt) +419 except: +420 self.datetime = None +421 self.datetime = dt +422 except: +423 self.datetime = None +424 else: +425 self.datetime = None +426 +427 def keys(self): +428 '''Returns a `dict_keys` class of all valid keys in the class (i.e. dict.keys())''' +429 return self._params.keys() +430 +431 def values(self): +432 '''Returns a `dict_values` class of all the values in the class (i.e. dict.values())''' +433 return self._params.values() +434 +435 def items(self): +436 '''Returns a `dict_items` class of all the values in the class (i.e. dict.items())''' +437 return self._params.items() +438 +439 +440class FileDirectory: +441 '''Contains type and pointer information for all blocks of data in an OPUS file. +442 +443 `FileDirectory` information is decoded from the raw file bytes of an OPUS file. First the header is read which +444 provides the start location of the directory block, number of blocks in file, and maximum number of blocks the file +445 supports. Then it decodes the block pointer information from each entry of the file's directory block. Rather than +446 store all file blocks in a single list (as it is done in the OPUS file directory), this class sorts the blocks into +447 categories: `data`, `data_status`, `params`, `rf_params`, `directory`, and `file_log`. It also pairs the data +448 blocks with their corresponding `data_status` block to simplify grouping y data with the parameters that are used to +449 generate x data and other data block specific metadata. +450 +451 Args: +452 filebytes: raw bytes from OPUS file. see: `brukeropus.file.parser.read_opus_file_bytes` +453 +454 Attributes: +455 start: pointer to start location of the directory block +456 max_blocks: maximum number of blocks supported by file +457 num_blocks: total number of blocks in the file +458 data_blocks: list of `FileBlockInfo` that contain array data (e.g. sample, reference, phase) +459 data_status_blocks: list of `FileBlockInfo` that contain metadata specific to a data block (units, etc.) +460 param_blocks: list of `FileBlockInfo` that contain metadata about the measurement sample +461 rf_param_blocks: list of `FileBlockInfo` that contain metatdata about the reference measurement +462 directory_block: `FileBlockInfo` for directory block that contains all the block info in the file +463 file_log_block: `FileBlockInfo` of the file log (changes, etc.) +464 data_and_status_block_pairs: (data: `FileBlockInfo`, data_status: `FileBlockInfo`) which pairs the data status +465 parameter block (time, x units, y units, etc.) with the data block it informs +466 unknown_blocks: list of `FileBlockInfo` with an unrecognized type (i.e. not sure how to parse) +467 ''' +468 +469 __slots__ = ('version', 'start', 'max_blocks', 'num_blocks', 'data_blocks', 'data_status_blocks', 'param_blocks', +470 'rf_param_blocks', 'directory_block', 'file_log_block', 'data_and_status_block_pairs', +471 'unknown_blocks') +472 +473 def __init__(self, filebytes: bytes): +474 self.version, self.start, self.max_blocks, self.num_blocks = parse_header(filebytes) +475 self.data_blocks: list = [] +476 self.data_status_blocks: list = [] +477 self.param_blocks: list = [] +478 self.rf_param_blocks: list = [] +479 self.directory_block: FileBlockInfo +480 self.file_log_block: FileBlockInfo +481 self.unknown_blocks: list = [] +>>>>>>> origin/master 482 for block_type, size, start in parse_directory(filebytes, self.start, self.num_blocks): 483 block = FileBlockInfo(block_type=block_type, size=size, start=start) 484 if block.is_data_status(): @@ -730,6 +812,7 @@

    491 self.directory_block = block 492 elif block.is_file_log(): 493 self.file_log_block = block +<<<<<<< HEAD 494 elif block.is_valid(): 495 self.data_blocks.append(block) 496 self.data_and_status_block_pairs = [] @@ -754,6 +837,35 @@

    515 warnings.warn(text) 516 else: 517 self.data_and_status_block_pairs.append((data_block, status_matches[0])) +======= +494 elif block.is_data(): +495 self.data_blocks.append(block) +496 else: +497 block.bytes = filebytes[block.start:block.start + block.size] +498 self.unknown_blocks.append(block) +499 self.data_and_status_block_pairs = [] +500 self._pair_data_and_status_blocks() +501 +502 def __str__(self): +503 data_keys = [b.get_data_key() for b in self.data_blocks] +504 data_str = ', '.join(data_keys) +505 return 'File Directory: ' + str(self.num_blocks) + ' total blocks; data blocks: (' + data_str + ')' +506 +507 def _pair_data_and_status_blocks(self): +508 for data_block in self.data_blocks: +509 status_matches = [block for block in self.data_status_blocks if block.is_data_status_match(data_block)] +510 if len(status_matches) == 0: +511 text = 'Warning: No data status block match for data block: ' + str(data_block) \ +512 + '\n\tdata block will be ignored.' +513 warnings.warn(text) +514 elif len(status_matches) > 1: +515 text = 'Warning: Multiple data status block matches for data block: ' + str(data_block) \ +516 + '\n\tMatches:' + '; '.join([str(match) for match in status_matches]) \ +517 + '\n\tdata block will be ignored.' +518 warnings.warn(text) +519 else: +520 self.data_and_status_block_pairs.append((data_block, status_matches[0])) +>>>>>>> origin/master

    @@ -1134,80 +1246,77 @@

    Data Attributes:
    162 start: pointer to start location of the block within the file 163 keys: tuple of three char keys contained in parameter blocks. This attribute is set by the OPUSFile class only 164 when the block is parameter block. This enables grouping parameters by block if desired. -165 ''' -166 -167 __slots__ = ('type', 'size', 'start', 'keys') -168 -169 keys: tuple -170 -171 def __init__(self, block_type: tuple, size: int, start: int): -172 self.type = block_type -173 self.size = size -174 self.start = start -175 -176 def __str__(self): -177 label = self.get_label() -178 return 'Block Info: ' + label + ' (size: ' + str(self.size) + ' bytes; start: ' + str(self.start) + ')' -179 -180 def is_valid(self): -181 '''Returns False if FileBlockInfo is undefined (i.e. FileBlockInfo.type == (0, 0, 0, 0, 0, 0))''' -182 return self.type != (0, 0, 0, 0, 0, 0) -183 -184 def is_data_status(self): -185 '''Returns True if FileBlockInfo is a data status parameter block''' -186 return self.type[2] == 1 -187 -188 def is_rf_param(self): -189 '''Returns True if FileBlockInfo is a parameter block associated with the reference measurement''' -190 return self.type[2] > 1 and self.type[1] == 2 -191 -192 def is_param(self): -193 '''Returns True if FileBlockInfo is a parameter block''' -194 return self.type[2] > 1 -195 -196 def is_directory(self): -197 '''Returns True if FileBlockInfo is the directory block''' -198 return self.type == (0, 0, 0, 13, 0, 0) -199 -200 def is_file_log(self): -201 '''Returns True if FileBlockInfo is the file log block''' -202 return self.type == (0, 0, 0, 0, 0, 5) -203 -204 def is_data(self): -205 '''Returns True if FileBlockInfo is a data block or 3D data block''' -206 return self.type[2] == 0 and self.type[3] > 0 and self.type[3] != 13 -207 -208 def is_3d_data(self): -209 '''Returns True if FileBlockInfo is a 3D data block (i.e. data series)''' -210 return self.is_data() and self.type[5] == 2 +165 bytes: raw bytes of file block (currently only set for unknown blocks) +166 ''' +167 +168 __slots__ = ('type', 'size', 'start', 'keys', 'bytes') +169 +170 keys: tuple +171 +172 def __init__(self, block_type: tuple, size: int, start: int): +173 self.type = block_type +174 self.size = size +175 self.start = start +176 +177 def __str__(self): +178 label = self.get_label() +179 return 'Block Info: ' + label + ' (size: ' + str(self.size) + ' bytes; start: ' + str(self.start) + ')' +180 +181 def is_data_status(self): +182 '''Returns True if FileBlockInfo is a data status parameter block''' +183 return self.type[2] == 1 +184 +185 def is_rf_param(self): +186 '''Returns True if FileBlockInfo is a parameter block associated with the reference measurement''' +187 return self.type[2] > 1 and self.type[1] == 2 +188 +189 def is_param(self): +190 '''Returns True if FileBlockInfo is a parameter block''' +191 return self.type[2] > 1 or self.type == (0, 0, 0, 0, 0, 1) +192 +193 def is_directory(self): +194 '''Returns True if FileBlockInfo is the directory block''' +195 return self.type == (0, 0, 0, 13, 0, 0) +196 +197 def is_file_log(self): +198 '''Returns True if FileBlockInfo is the file log block''' +199 return self.type == (0, 0, 0, 0, 0, 5) +200 +201 def is_data(self): +202 '''Returns True if FileBlockInfo is a data block or 3D data block''' +203 return self.type[0] > 0 and self.type[1] > 0 and self.type[2] == 0 and self.type[3] > 0 +204 +205 def is_3d_data(self): +206 '''Returns True if FileBlockInfo is a 3D data block (i.e. data series)''' +207 return self.is_data() and self.type[5] == 2 +208 +209 def is_data_status_match(self, data_block_info): +210 '''Returns True if FileBlockInfo is a data status block and a match to the data_block_info argument. 211 -212 def is_data_status_match(self, data_block_info): -213 '''Returns True if FileBlockInfo is a data status block and a match to the data_block_info argument. +212 This function is used to match a data status block (contains metadata for data block) with its associated data +213 block (contains array data). 214 -215 This function is used to match a data status block (contains metadata for data block) with its associated data -216 block (contains array data). +215 Args: +216 data_block_info (FileBlockInfo): data block being tested as a match. 217 -218 Args: -219 data_block_info (FileBlockInfo): data block being tested as a match. -220 -221 Returns: -222 is_match (bool): True if FileBlockInfo is data status block and input argument is matching data block''' -223 if self.is_data_status(): -224 return data_block_info.type[:2] == self.type[:2] and data_block_info.type[3:] == self.type[3:] -225 -226 def get_label(self): -227 '''Returns a friendly string label that describes the block type''' -228 return get_block_type_label(self.type) +218 Returns: +219 is_match (bool): True if FileBlockInfo is data status block and input argument is matching data block''' +220 if self.is_data_status(): +221 return data_block_info.type[:2] == self.type[:2] and data_block_info.type[3:] == self.type[3:] +222 +223 def get_label(self): +224 '''Returns a friendly string label that describes the block type''' +225 return get_block_type_label(self.type) +226 +227 def get_data_key(self): +228 '''If block is a data block, this function will return an shorthand key to reference that data. 229 -230 def get_data_key(self): -231 '''If block is a data block, this function will return an shorthand key to reference that data. -232 -233 e.g. t: transmission, a: absorption, sm: sample, rf: reference, smph: sample phase etc. If the block is not -234 a data block, it will return None.''' -235 if self.is_data(): -236 return get_data_key(self.type) -237 else: -238 return None +230 e.g. t: transmission, a: absorption, sm: sample, rf: reference, smph: sample phase etc. If the block is not +231 a data block, it will return None.''' +232 if self.is_data(): +233 return get_data_key(self.type) +234 else: +235 return None @@ -1232,6 +1341,7 @@
    Attributes:
  • start: pointer to start location of the block within the file
  • keys: tuple of three char keys contained in parameter blocks. This attribute is set by the OPUSFile class only when the block is parameter block. This enables grouping parameters by block if desired.
  • +
  • bytes: raw bytes of file block (currently only set for unknown blocks)
  • @@ -1246,10 +1356,10 @@
    Attributes:
    -
    171    def __init__(self, block_type: tuple, size: int, start: int):
    -172        self.type = block_type
    -173        self.size = size
    -174        self.start = start
    +            
    172    def __init__(self, block_type: tuple, size: int, start: int):
    +173        self.type = block_type
    +174        self.size = size
    +175        self.start = start
     
    @@ -1299,28 +1409,6 @@
    Attributes:
    -
    -
    - -
    - - def - is_valid(self): - - - -
    - -
    180    def is_valid(self):
    -181        '''Returns False if FileBlockInfo is undefined (i.e. FileBlockInfo.type == (0, 0, 0, 0, 0, 0))'''
    -182        return self.type != (0, 0, 0, 0, 0, 0)
    -
    - - -

    Returns False if FileBlockInfo is undefined (i.e. FileBlockInfo.type == (0, 0, 0, 0, 0, 0))

    -
    - -
    @@ -1333,9 +1421,9 @@
    Attributes:
    -
    184    def is_data_status(self):
    -185        '''Returns True if FileBlockInfo is a data status parameter block'''
    -186        return self.type[2] == 1
    +            
    181    def is_data_status(self):
    +182        '''Returns True if FileBlockInfo is a data status parameter block'''
    +183        return self.type[2] == 1
     
    @@ -1355,9 +1443,9 @@
    Attributes:
    -
    188    def is_rf_param(self):
    -189        '''Returns True if FileBlockInfo is a parameter block associated with the reference measurement'''
    -190        return self.type[2] > 1 and self.type[1] == 2
    +            
    185    def is_rf_param(self):
    +186        '''Returns True if FileBlockInfo is a parameter block associated with the reference measurement'''
    +187        return self.type[2] > 1 and self.type[1] == 2
     
    @@ -1377,9 +1465,9 @@
    Attributes:
    -
    192    def is_param(self):
    -193        '''Returns True if FileBlockInfo is a parameter block'''
    -194        return self.type[2] > 1
    +            
    189    def is_param(self):
    +190        '''Returns True if FileBlockInfo is a parameter block'''
    +191        return self.type[2] > 1 or self.type == (0, 0, 0, 0, 0, 1)
     
    @@ -1399,9 +1487,9 @@
    Attributes:
    -
    196    def is_directory(self):
    -197        '''Returns True if FileBlockInfo is the directory block'''
    -198        return self.type == (0, 0, 0, 13, 0, 0)
    +            
    193    def is_directory(self):
    +194        '''Returns True if FileBlockInfo is the directory block'''
    +195        return self.type == (0, 0, 0, 13, 0, 0)
     
    @@ -1421,9 +1509,9 @@
    Attributes:
    -
    200    def is_file_log(self):
    -201        '''Returns True if FileBlockInfo is the file log block'''
    -202        return self.type == (0, 0, 0, 0, 0, 5)
    +            
    197    def is_file_log(self):
    +198        '''Returns True if FileBlockInfo is the file log block'''
    +199        return self.type == (0, 0, 0, 0, 0, 5)
     
    @@ -1443,9 +1531,9 @@
    Attributes:
    -
    204    def is_data(self):
    -205        '''Returns True if FileBlockInfo is a data block or 3D data block'''
    -206        return self.type[2] == 0 and self.type[3] > 0 and self.type[3] != 13
    +            
    201    def is_data(self):
    +202        '''Returns True if FileBlockInfo is a data block or 3D data block'''
    +203        return self.type[0] > 0 and self.type[1] > 0 and self.type[2] == 0 and self.type[3] > 0
     
    @@ -1465,9 +1553,9 @@
    Attributes:
    -
    208    def is_3d_data(self):
    -209        '''Returns True if FileBlockInfo is a 3D data block (i.e. data series)'''
    -210        return self.is_data() and self.type[5] == 2
    +            
    205    def is_3d_data(self):
    +206        '''Returns True if FileBlockInfo is a 3D data block (i.e. data series)'''
    +207        return self.is_data() and self.type[5] == 2
     
    @@ -1487,19 +1575,19 @@
    Attributes:
    -
    212    def is_data_status_match(self, data_block_info):
    -213        '''Returns True if FileBlockInfo is a data status block and a match to the data_block_info argument.
    +            
    209    def is_data_status_match(self, data_block_info):
    +210        '''Returns True if FileBlockInfo is a data status block and a match to the data_block_info argument.
    +211
    +212        This function is used to match a data status block (contains metadata for data block) with its associated data
    +213        block (contains array data).
     214
    -215        This function is used to match a data status block (contains metadata for data block) with its associated data
    -216        block (contains array data).
    +215        Args:
    +216            data_block_info (FileBlockInfo):  data block being tested as a match.
     217
    -218        Args:
    -219            data_block_info (FileBlockInfo):  data block being tested as a match.
    -220
    -221        Returns:
    -222            is_match (bool): True if FileBlockInfo is data status block and input argument is matching data block'''
    -223        if self.is_data_status():
    -224            return data_block_info.type[:2] == self.type[:2] and data_block_info.type[3:] == self.type[3:]
    +218        Returns:
    +219            is_match (bool): True if FileBlockInfo is data status block and input argument is matching data block'''
    +220        if self.is_data_status():
    +221            return data_block_info.type[:2] == self.type[:2] and data_block_info.type[3:] == self.type[3:]
     
    @@ -1534,9 +1622,9 @@
    Returns:
    -
    226    def get_label(self):
    -227        '''Returns a friendly string label that describes the block type'''
    -228        return get_block_type_label(self.type)
    +            
    223    def get_label(self):
    +224        '''Returns a friendly string label that describes the block type'''
    +225        return get_block_type_label(self.type)
     
    @@ -1556,15 +1644,15 @@
    Returns:
    -
    230    def get_data_key(self):
    -231        '''If block is a data block, this function will return an shorthand key to reference that data.
    -232
    -233        e.g. t: transmission, a: absorption, sm: sample, rf: reference, smph: sample phase etc. If the block is not
    -234        a data block, it will return None.'''
    -235        if self.is_data():
    -236            return get_data_key(self.type)
    -237        else:
    -238            return None
    +            
    227    def get_data_key(self):
    +228        '''If block is a data block, this function will return an shorthand key to reference that data.
    +229
    +230        e.g. t: transmission, a: absorption, sm: sample, rf: reference, smph: sample phase etc. If the block is not
    +231        a data block, it will return None.'''
    +232        if self.is_data():
    +233            return get_data_key(self.type)
    +234        else:
    +235            return None
     
    @@ -1575,6 +1663,17 @@
    Returns:
    + +
    +
    + bytes + + +
    + + + +
    @@ -1588,82 +1687,82 @@
    Returns:
    -
    241class Data:
    -242    '''Class containing array data and associated parameter/metadata from an OPUS file.
    -243
    -244    Args:
    -245        filebytes: raw bytes from OPUS file. see: `read_opus_file_bytes`
    -246        data_info: `FileBlockInfo` instance of a data block
    -247        data_status_info: `FileBlockInfo` instance of a data status block which contains metadata about the data_info
    -248            block. This block is a parameter block.
    -249
    -250    Attributes:
    -251        params: `Parameter` class with metadata associated with the data block such as first x point: `fxp`, last x
    -252            point: `lxp`, number of points: `npt`, date: `dat`, time: `tim` etc.
    -253        y: 1D `numpy` array containing y values of data block
    -254        x: 1D `numpy` array containing x values of data block. Units of x array are given by `dxu` parameter.
    -255        label: human-readable string label describing the data block (e.g. Sample Spectrum, Absorbance, etc.)
    -256
    -257    Extended Attributes:
    -258        **wn:** Returns the x array in wavenumber (cm⁻¹) units regardless of what units the x array was originally
    +            
    238class Data:
    +239    '''Class containing array data and associated parameter/metadata from an OPUS file.
    +240
    +241    Args:
    +242        filebytes: raw bytes from OPUS file. see: `read_opus_file_bytes`
    +243        data_info: `FileBlockInfo` instance of a data block
    +244        data_status_info: `FileBlockInfo` instance of a data status block which contains metadata about the data_info
    +245            block. This block is a parameter block.
    +246
    +247    Attributes:
    +248        params: `Parameter` class with metadata associated with the data block such as first x point: `fxp`, last x
    +249            point: `lxp`, number of points: `npt`, date: `dat`, time: `tim` etc.
    +250        y: 1D `numpy` array containing y values of data block
    +251        x: 1D `numpy` array containing x values of data block. Units of x array are given by `dxu` parameter.
    +252        label: human-readable string label describing the data block (e.g. Sample Spectrum, Absorbance, etc.)
    +253
    +254    Extended Attributes:
    +255        **wn:** Returns the x array in wavenumber (cm⁻¹) units regardless of what units the x array was originally
    +256            saved in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not
    +257            interferogram or phase blocks.  
    +258        **wl:** Returns the x array in wavelength (µm) units regardless of what units the x array was originally
     259            saved in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not
     260            interferogram or phase blocks.  
    -261        **wl:** Returns the x array in wavelength (µm) units regardless of what units the x array was originally
    -262            saved in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not
    -263            interferogram or phase blocks.  
    -264        **f:** Returns the x array in modulation frequency units (Hz) regardless of what units the x array was
    -265            originally saved in. This is only valid for spectral data blocks such as sample, reference, transmission,
    -266            etc., not interferogram or phase blocks.  
    -267        **datetime:** Returns a `datetime` class of when the data was taken (extracted from data status parameter block).  
    -268        **xxx:** the various three char parameter keys from the `params` attribute can be directly called from the 
    -269            `Data` class for convenience. Common parameters include `dxu` (x units), `mxy` (max y value), `mny` (min y
    -270            value), etc.  
    -271    '''
    -272    __slots__ = ('_key', 'params', 'y', 'x', 'label', 'vel')
    -273
    -274    def __init__(self, filebytes: bytes, data_info: FileBlockInfo, data_status_info: FileBlockInfo):
    -275        self._key = data_info.get_data_key()
    -276        self.params = Parameters(filebytes, [data_status_info])
    -277        y = parse_data_block(filebytes, size=data_info.size, start=data_info.start, dpf=self.params.dpf)
    -278        self.y = y[:self.params.npt]    # Trim extra values on some spectra
    -279        self.x = np.linspace(self.params.fxv, self.params.lxv, self.params.npt)
    -280        self.label = data_info.get_label()
    -281        self.vel = 0
    -282
    -283    def __getattr__(self, name):
    -284        if name.lower() == 'wn' and self.params.dxu in ('WN', 'MI', 'LGW'):
    -285            return self._get_wn()
    -286        elif name.lower() == 'wl' and self.params.dxu in ('WN', 'MI', 'LGW'):
    -287            return self._get_wl()
    -288        elif name.lower() == 'f' and self.params.dxu in ('WN', 'MI', 'LGW'):
    -289            return self._get_freq()
    -290        elif name.lower() in self.params.keys():
    -291            return getattr(self.params, name.lower())
    -292        elif name == 'datetime':
    -293            return self.params.datetime
    -294        else:
    -295            text = str(name) + ' is not a valid attribute for Data: ' + str(self._key)
    -296            raise AttributeError(text)
    -297
    -298    def _get_wn(self):
    -299        if self.params.dxu == 'WN':
    -300            return self.x
    -301        elif self.params.dxu == 'MI':
    -302            return 10000. / self.x
    -303        elif self.params.dxu == 'LGW':
    -304            return np.exp(self.x)
    -305
    -306    def _get_wl(self):
    -307        if self.params.dxu == 'WN':
    -308            return 10000. / self.x
    -309        elif self.params.dxu == 'MI':
    -310            return self.x
    -311        elif self.params.dxu == 'LGW':
    -312            return 10000 / np.exp(self.x)
    -313    
    -314    def _get_freq(self):
    -315        vel = 1000 * np.float(self.vel) / 7900  # cm/s
    -316        return vel * self.wn
    +261        **f:** Returns the x array in modulation frequency units (Hz) regardless of what units the x array was
    +262            originally saved in. This is only valid for spectral data blocks such as sample, reference, transmission,
    +263            etc., not interferogram or phase blocks.  
    +264        **datetime:** Returns a `datetime` class of when the data was taken (extracted from data status parameter block).  
    +265        **xxx:** the various three char parameter keys from the `params` attribute can be directly called from the 
    +266            `Data` class for convenience. Common parameters include `dxu` (x units), `mxy` (max y value), `mny` (min y
    +267            value), etc.  
    +268    '''
    +269    __slots__ = ('_key', 'params', 'y', 'x', 'label', 'vel')
    +270
    +271    def __init__(self, filebytes: bytes, data_info: FileBlockInfo, data_status_info: FileBlockInfo):
    +272        self._key = data_info.get_data_key()
    +273        self.params = Parameters(filebytes, [data_status_info])
    +274        y = parse_data_block(filebytes, size=data_info.size, start=data_info.start, dpf=self.params.dpf)
    +275        self.y = y[:self.params.npt]    # Trim extra values on some spectra
    +276        self.x = np.linspace(self.params.fxv, self.params.lxv, self.params.npt)
    +277        self.label = data_info.get_label()
    +278        self.vel = 0
    +279
    +280    def __getattr__(self, name):
    +281        if name.lower() == 'wn' and self.params.dxu in ('WN', 'MI', 'LGW'):
    +282            return self._get_wn()
    +283        elif name.lower() == 'wl' and self.params.dxu in ('WN', 'MI', 'LGW'):
    +284            return self._get_wl()
    +285        elif name.lower() == 'f' and self.params.dxu in ('WN', 'MI', 'LGW'):
    +286            return self._get_freq()
    +287        elif name.lower() in self.params.keys():
    +288            return getattr(self.params, name.lower())
    +289        elif name == 'datetime':
    +290            return self.params.datetime
    +291        else:
    +292            text = str(name) + ' is not a valid attribute for Data: ' + str(self._key)
    +293            raise AttributeError(text)
    +294
    +295    def _get_wn(self):
    +296        if self.params.dxu == 'WN':
    +297            return self.x
    +298        elif self.params.dxu == 'MI':
    +299            return 10000. / self.x
    +300        elif self.params.dxu == 'LGW':
    +301            return np.exp(self.x)
    +302
    +303    def _get_wl(self):
    +304        if self.params.dxu == 'WN':
    +305            return 10000. / self.x
    +306        elif self.params.dxu == 'MI':
    +307            return self.x
    +308        elif self.params.dxu == 'LGW':
    +309            return 10000 / np.exp(self.x)
    +310    
    +311    def _get_freq(self):
    +312        vel = 1000 * np.float(self.vel) / 7900  # cm/s
    +313        return vel * self.wn
     
    @@ -1718,14 +1817,14 @@
    Extended Attributes:
    -
    274    def __init__(self, filebytes: bytes, data_info: FileBlockInfo, data_status_info: FileBlockInfo):
    -275        self._key = data_info.get_data_key()
    -276        self.params = Parameters(filebytes, [data_status_info])
    -277        y = parse_data_block(filebytes, size=data_info.size, start=data_info.start, dpf=self.params.dpf)
    -278        self.y = y[:self.params.npt]    # Trim extra values on some spectra
    -279        self.x = np.linspace(self.params.fxv, self.params.lxv, self.params.npt)
    -280        self.label = data_info.get_label()
    -281        self.vel = 0
    +            
    271    def __init__(self, filebytes: bytes, data_info: FileBlockInfo, data_status_info: FileBlockInfo):
    +272        self._key = data_info.get_data_key()
    +273        self.params = Parameters(filebytes, [data_status_info])
    +274        y = parse_data_block(filebytes, size=data_info.size, start=data_info.start, dpf=self.params.dpf)
    +275        self.y = y[:self.params.npt]    # Trim extra values on some spectra
    +276        self.x = np.linspace(self.params.fxv, self.params.lxv, self.params.npt)
    +277        self.label = data_info.get_label()
    +278        self.vel = 0
     
    @@ -1799,49 +1898,49 @@
    Extended Attributes:
    -
    319class Data3D(Data):
    -320    '''Class containing 3D array data (series of spectra) and associated parameter/metadata from an OPUS file.
    -321
    -322    Args:
    -323        filebytes: raw bytes from OPUS file. see: read_opus_file_bytes
    -324        data_info: FileBlockInfo instance of a 3D data block
    -325        data_status_info: FileBlockInfo instance of a data status block which contains metadata about the data_info
    -326            block. This block is a parameter block.
    -327
    -328    Attributes:
    -329        params: Parameter class with metadata associated with the data block such as first x point (fxp), last x point
    -330            (lxp), number of points (npt), date (dat), time (tim) etc.
    -331        y: 2D numpy array containing y values of data block
    -332        x: 1D numpy array containing x values of data block. Units of x array are given by .dxu attribute.
    -333        num_spectra: number of spectra in the series (i.e. length of y)
    -334        label: human-readable string label describing the data block (e.g. Sample Spectrum, Absorbance, etc.)
    -335
    -336    Extended Attributes:
    -337        **wn:** Returns the x array in wavenumber (cm⁻¹) units regardless of what units the x array was originally saved
    +            
    316class Data3D(Data):
    +317    '''Class containing 3D array data (series of spectra) and associated parameter/metadata from an OPUS file.
    +318
    +319    Args:
    +320        filebytes: raw bytes from OPUS file. see: read_opus_file_bytes
    +321        data_info: FileBlockInfo instance of a 3D data block
    +322        data_status_info: FileBlockInfo instance of a data status block which contains metadata about the data_info
    +323            block. This block is a parameter block.
    +324
    +325    Attributes:
    +326        params: Parameter class with metadata associated with the data block such as first x point (fxp), last x point
    +327            (lxp), number of points (npt), date (dat), time (tim) etc.
    +328        y: 2D numpy array containing y values of data block
    +329        x: 1D numpy array containing x values of data block. Units of x array are given by .dxu attribute.
    +330        num_spectra: number of spectra in the series (i.e. length of y)
    +331        label: human-readable string label describing the data block (e.g. Sample Spectrum, Absorbance, etc.)
    +332
    +333    Extended Attributes:
    +334        **wn:** Returns the x array in wavenumber (cm⁻¹) units regardless of what units the x array was originally saved
    +335            in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not
    +336            interferogram or phase blocks.  
    +337        **wl:** Returns the x array in wavelength (µm) units regardless of what units the x array was originally saved
     338            in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not
     339            interferogram or phase blocks.  
    -340        **wl:** Returns the x array in wavelength (µm) units regardless of what units the x array was originally saved
    -341            in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not
    -342            interferogram or phase blocks.  
    -343        **datetime:** Returns a `datetime` class of when the data was taken (extracted from data status parameter
    -344            block).  
    -345        **xxx:** the various three char parameter keys from the "params" attribute can be directly called from the data
    -346            class for convenience. Several of these parameters return arrays, rather than singular values because they
    -347            are recorded for every spectra in the series, e.g. `npt`, `mny`, `mxy`, `tim`, `nsn`.  
    -348    '''
    -349    __slots__ = ('_key', 'params', 'y', 'x', 'num_spectra', 'label')
    -350
    -351    def __init__(self, filebytes: bytes, data_info: FileBlockInfo, data_status_info: FileBlockInfo):
    -352        self._key = data_info.get_data_key()
    -353        self.params = Parameters(filebytes, [data_status_info])
    -354        data = parse_3d_data_block(filebytes, start=data_info.start, dpf=self.params.dpf)
    -355        self.y = data['y'][:, :self.params.npt]    # Trim extra values on some spectra
    -356        self.x = np.linspace(self.params.fxv, self.params.lxv, self.params.npt)
    -357        self.num_spectra = data['num_blocks']
    -358        for key, val in data.items():
    -359            if key not in ['y', 'version', 'offset', 'num_blocks', 'data_size', 'info_size']:
    -360                self.params._params[key] = val
    -361        self.label = data_info.get_label()
    +340        **datetime:** Returns a `datetime` class of when the data was taken (extracted from data status parameter
    +341            block).  
    +342        **xxx:** the various three char parameter keys from the "params" attribute can be directly called from the data
    +343            class for convenience. Several of these parameters return arrays, rather than singular values because they
    +344            are recorded for every spectra in the series, e.g. `npt`, `mny`, `mxy`, `tim`, `nsn`.  
    +345    '''
    +346    __slots__ = ('_key', 'params', 'y', 'x', 'num_spectra', 'label')
    +347
    +348    def __init__(self, filebytes: bytes, data_info: FileBlockInfo, data_status_info: FileBlockInfo):
    +349        self._key = data_info.get_data_key()
    +350        self.params = Parameters(filebytes, [data_status_info])
    +351        data = parse_3d_data_block(filebytes, start=data_info.start, dpf=self.params.dpf)
    +352        self.y = data['y'][:, :self.params.npt]    # Trim extra values on some spectra
    +353        self.x = np.linspace(self.params.fxv, self.params.lxv, self.params.npt)
    +354        self.num_spectra = data['num_blocks']
    +355        for key, val in data.items():
    +356            if key not in ['y', 'version', 'offset', 'num_blocks', 'data_size', 'info_size']:
    +357                self.params._params[key] = val
    +358        self.label = data_info.get_label()
     
    @@ -1895,17 +1994,17 @@
    Extended Attributes:
    -
    351    def __init__(self, filebytes: bytes, data_info: FileBlockInfo, data_status_info: FileBlockInfo):
    -352        self._key = data_info.get_data_key()
    -353        self.params = Parameters(filebytes, [data_status_info])
    -354        data = parse_3d_data_block(filebytes, start=data_info.start, dpf=self.params.dpf)
    -355        self.y = data['y'][:, :self.params.npt]    # Trim extra values on some spectra
    -356        self.x = np.linspace(self.params.fxv, self.params.lxv, self.params.npt)
    -357        self.num_spectra = data['num_blocks']
    -358        for key, val in data.items():
    -359            if key not in ['y', 'version', 'offset', 'num_blocks', 'data_size', 'info_size']:
    -360                self.params._params[key] = val
    -361        self.label = data_info.get_label()
    +            
    348    def __init__(self, filebytes: bytes, data_info: FileBlockInfo, data_status_info: FileBlockInfo):
    +349        self._key = data_info.get_data_key()
    +350        self.params = Parameters(filebytes, [data_status_info])
    +351        data = parse_3d_data_block(filebytes, start=data_info.start, dpf=self.params.dpf)
    +352        self.y = data['y'][:, :self.params.npt]    # Trim extra values on some spectra
    +353        self.x = np.linspace(self.params.fxv, self.params.lxv, self.params.npt)
    +354        self.num_spectra = data['num_blocks']
    +355        for key, val in data.items():
    +356            if key not in ['y', 'version', 'offset', 'num_blocks', 'data_size', 'info_size']:
    +357                self.params._params[key] = val
    +358        self.label = data_info.get_label()
     
    @@ -1988,49 +2087,53 @@
    Inherited Members
    -
    364class Parameters:
    -365    '''Class containing parameter metadata of an OPUS file.
    -366
    -367    Parameters of an OPUS file are stored as key, val pairs, where the key is always three chars.  For example, the
    -368    beamsplitter is stored in the "bms" attribute, source in "src" etc.  A list of known keys, with friendly label can
    -369    be found in `brukeropus.file.constants.PARAM_LABELS`.  The keys in an OPUS file are not case sensitive, and stored
    -370    in all CAPS (i.e. `BMS`, `SRC`, etc.) but this class uses lower case keys to follow python convention.  The class is
    -371    initialized from a list of parameter `FileBlockInfo`.  The key, val items in blocks of the list are combined into
    -372    one parameter class, so care must be taken not to pass blocks that will overwrite each others keys.  Analagous to a
    -373    dict, the keys, values, and (key, val) can be iterated over using the functions: `keys()`, `values()`, and `items()`
    -374    respectively.
    -375
    -376    Args:
    -377        filebytes: raw bytes from OPUS file. see: `brukeropus.file.parser.read_opus_file_bytes`
    -378        param_blocks: list of `FileBlockInfo`; every block in the list should be classified as a parameter block.
    -379
    -380    Attributes:
    -381        xxx: parameter attributes are stored as three char keys. Which keys are generated depends on the list of
    -382            `FileBlockInfo` that is used to initialize the class. If input list contains a single data status
    -383            `FileBlockInfo`, attributes will include: `fxv`, `lxv`, `npt` (first x-val, last x-val, number of points),
    -384            etc. Other blocks produce attributes such as: `bms`, `src`, `apt` (beamsplitter, source, aperture) etc. A
    -385            full list of keys available in a given Parameters instance are given by the `keys()` method.
    -386        datetime: if blocks contain the keys: `dat` (date) and `tim` (time), the `datetime` attribute of this class will
    -387            be set to a python `datetime` object. Currently, only data status blocks are known to have these keys. If
    -388            `dat` and `tim` are not present in the class, the `datetime` attribute will return `None`.
    -389    '''
    -390    __slots__ = ('_params', 'datetime')
    -391
    -392    def __init__(self, filebytes: bytes, param_blocks: list):
    -393        self._params = dict()
    -394        for block_info in param_blocks:
    -395            params = {key.lower(): val for key, val in parse_param_block(filebytes, block_info.size, block_info.start)}
    -396            self._params.update(params)
    -397            block_info.keys = tuple(params.keys())
    -398        self._set_datetime()
    -399
    -400    def __getattr__(self, name):
    -401        if name.lower() in self._params.keys():
    -402            return self._params[name.lower()]
    -403        else:
    -404            text = str(name) + ' not a valid attribute. For list of valid parameter keys, use: .keys()'
    -405            raise AttributeError(text)
    +            
    361class Parameters:
    +362    '''Class containing parameter metadata of an OPUS file.
    +363
    +364    Parameters of an OPUS file are stored as key, val pairs, where the key is always three chars.  For example, the
    +365    beamsplitter is stored in the "bms" attribute, source in "src" etc.  A list of known keys, with friendly label can
    +366    be found in `brukeropus.file.constants.PARAM_LABELS`.  The keys in an OPUS file are not case sensitive, and stored
    +367    in all CAPS (i.e. `BMS`, `SRC`, etc.) but this class uses lower case keys to follow python convention.  The class is
    +368    initialized from a list of parameter `FileBlockInfo`.  The key, val items in blocks of the list are combined into
    +369    one parameter class, so care must be taken not to pass blocks that will overwrite each others keys.  Analagous to a
    +370    dict, the keys, values, and (key, val) can be iterated over using the functions: `keys()`, `values()`, and `items()`
    +371    respectively.
    +372
    +373    Args:
    +374        filebytes: raw bytes from OPUS file. see: `brukeropus.file.parser.read_opus_file_bytes`
    +375        param_blocks: list of `FileBlockInfo`; every block in the list should be classified as a parameter block.
    +376
    +377    Attributes:
    +378        xxx: parameter attributes are stored as three char keys. Which keys are generated depends on the list of
    +379            `FileBlockInfo` that is used to initialize the class. If input list contains a single data status
    +380            `FileBlockInfo`, attributes will include: `fxv`, `lxv`, `npt` (first x-val, last x-val, number of points),
    +381            etc. Other blocks produce attributes such as: `bms`, `src`, `apt` (beamsplitter, source, aperture) etc. A
    +382            full list of keys available in a given Parameters instance are given by the `keys()` method.
    +383        datetime: if blocks contain the keys: `dat` (date) and `tim` (time), the `datetime` attribute of this class will
    +384            be set to a python `datetime` object. Currently, only data status blocks are known to have these keys. If
    +385            `dat` and `tim` are not present in the class, the `datetime` attribute will return `None`.
    +386    '''
    +387    __slots__ = ('_params', 'datetime')
    +388
    +389    def __init__(self, filebytes: bytes, param_blocks: list):
    +390        self._params = dict()
    +391        for block_info in param_blocks:
    +392            params = {key.lower(): val for key, val in parse_param_block(filebytes, block_info.size, block_info.start)}
    +393            self._params.update(params)
    +394            block_info.keys = tuple(params.keys())
    +395        self._set_datetime()
    +396
    +397    def __getattr__(self, name):
    +398        if name.lower() in self._params.keys():
    +399            return self._params[name.lower()]
    +400        else:
    +401            text = str(name) + ' not a valid attribute. For list of valid parameter keys, use: .keys()'
    +402            raise AttributeError(text)
    +403
    +404    def __getitem__(self, item):
    +405        return self._params.__getitem__(item)
     406
    +<<<<<<< HEAD
     407    def __getitem__(self, item):
     408        return self._params.__getitem__(item)
     409
    @@ -2066,6 +2169,40 @@ 
    Inherited Members
    439 def items(self): 440 '''Returns a `dict_items` class of all the values in the class (i.e. dict.items())''' 441 return self._params.items() +======= +407 def _set_datetime(self): +408 if 'dat' in self.keys() and 'tim' in self.keys(): +409 try: +410 date_str = self.dat +411 time_str = self.tim +412 dt_str = date_str + '-' + time_str[:time_str.index(' (')] +413 try: +414 fmt = '%d/%m/%Y-%H:%M:%S.%f' +415 dt = datetime.datetime.strptime(dt_str, fmt) +416 except: +417 try: +418 fmt = '%Y/%m/%d-%H:%M:%S.%f' +419 dt = datetime.datetime.strptime(dt_str, fmt) +420 except: +421 self.datetime = None +422 self.datetime = dt +423 except: +424 self.datetime = None +425 else: +426 self.datetime = None +427 +428 def keys(self): +429 '''Returns a `dict_keys` class of all valid keys in the class (i.e. dict.keys())''' +430 return self._params.keys() +431 +432 def values(self): +433 '''Returns a `dict_values` class of all the values in the class (i.e. dict.values())''' +434 return self._params.values() +435 +436 def items(self): +437 '''Returns a `dict_items` class of all the values in the class (i.e. dict.items())''' +438 return self._params.items() +>>>>>>> origin/master
    @@ -2112,13 +2249,13 @@
    Attributes:
    -
    392    def __init__(self, filebytes: bytes, param_blocks: list):
    -393        self._params = dict()
    -394        for block_info in param_blocks:
    -395            params = {key.lower(): val for key, val in parse_param_block(filebytes, block_info.size, block_info.start)}
    -396            self._params.update(params)
    -397            block_info.keys = tuple(params.keys())
    -398        self._set_datetime()
    +            
    389    def __init__(self, filebytes: bytes, param_blocks: list):
    +390        self._params = dict()
    +391        for block_info in param_blocks:
    +392            params = {key.lower(): val for key, val in parse_param_block(filebytes, block_info.size, block_info.start)}
    +393            self._params.update(params)
    +394            block_info.keys = tuple(params.keys())
    +395        self._set_datetime()
     
    @@ -2136,9 +2273,15 @@
    Attributes:
    +<<<<<<< HEAD
    431    def keys(self):
     432        '''Returns a `dict_keys` class of all valid keys in the class (i.e. dict.keys())'''
     433        return self._params.keys()
    +=======
    +            
    428    def keys(self):
    +429        '''Returns a `dict_keys` class of all valid keys in the class (i.e. dict.keys())'''
    +430        return self._params.keys()
    +>>>>>>> origin/master
     
    @@ -2158,9 +2301,15 @@
    Attributes:
    +<<<<<<< HEAD
    435    def values(self):
     436        '''Returns a `dict_values` class of all the values in the class (i.e. dict.values())'''
     437        return self._params.values()
    +=======
    +            
    432    def values(self):
    +433        '''Returns a `dict_values` class of all the values in the class (i.e. dict.values())'''
    +434        return self._params.values()
    +>>>>>>> origin/master
     
    @@ -2180,9 +2329,15 @@
    Attributes:
    +<<<<<<< HEAD
    439    def items(self):
     440        '''Returns a `dict_items` class of all the values in the class (i.e. dict.items())'''
     441        return self._params.items()
    +=======
    +            
    436    def items(self):
    +437        '''Returns a `dict_items` class of all the values in the class (i.e. dict.items())'''
    +438        return self._params.items()
    +>>>>>>> origin/master
     
    @@ -2214,6 +2369,7 @@
    Attributes:
    +<<<<<<< HEAD
    444class FileDirectory:
     445    '''Contains type and pointer information for all blocks of data in an OPUS file.
     446
    @@ -2253,6 +2409,50 @@ 
    Attributes:
    480 self.rf_param_blocks: list = [] 481 self.directory_block: FileBlockInfo 482 self.file_log_block: FileBlockInfo +======= +
    441class FileDirectory:
    +442    '''Contains type and pointer information for all blocks of data in an OPUS file.
    +443
    +444    `FileDirectory` information is decoded from the raw file bytes of an OPUS file. First the header is read which
    +445    provides the start location of the directory block, number of blocks in file, and maximum number of blocks the file
    +446    supports. Then it decodes the block pointer information from each entry of the file's directory block. Rather than
    +447    store all file blocks in a single list (as it is done in the OPUS file directory), this class sorts the blocks into
    +448    categories: `data`, `data_status`, `params`, `rf_params`, `directory`, and `file_log`.  It also pairs the data
    +449    blocks with their corresponding `data_status` block to simplify grouping y data with the parameters that are used to
    +450    generate x data and other data block specific metadata.
    +451
    +452    Args:
    +453        filebytes: raw bytes from OPUS file. see: `brukeropus.file.parser.read_opus_file_bytes`
    +454
    +455    Attributes:
    +456        start: pointer to start location of the directory block
    +457        max_blocks: maximum number of blocks supported by file
    +458        num_blocks: total number of blocks in the file
    +459        data_blocks: list of `FileBlockInfo` that contain array data (e.g. sample, reference, phase)
    +460        data_status_blocks: list of `FileBlockInfo` that contain metadata specific to a data block (units, etc.)
    +461        param_blocks: list of `FileBlockInfo` that contain metadata about the measurement sample
    +462        rf_param_blocks: list of `FileBlockInfo` that contain metatdata about the reference measurement
    +463        directory_block: `FileBlockInfo` for directory block that contains all the block info in the file
    +464        file_log_block: `FileBlockInfo` of the file log (changes, etc.)
    +465        data_and_status_block_pairs: (data: `FileBlockInfo`, data_status: `FileBlockInfo`) which pairs the data status
    +466            parameter block (time, x units, y units, etc.) with the data block it informs
    +467        unknown_blocks: list of `FileBlockInfo` with an unrecognized type (i.e. not sure how to parse)
    +468    '''
    +469
    +470    __slots__ = ('version', 'start', 'max_blocks', 'num_blocks', 'data_blocks', 'data_status_blocks', 'param_blocks',
    +471                 'rf_param_blocks', 'directory_block', 'file_log_block', 'data_and_status_block_pairs',
    +472                 'unknown_blocks')
    +473
    +474    def __init__(self, filebytes: bytes):
    +475        self.version, self.start, self.max_blocks, self.num_blocks = parse_header(filebytes)
    +476        self.data_blocks: list = []
    +477        self.data_status_blocks: list = []
    +478        self.param_blocks: list = []
    +479        self.rf_param_blocks: list = []
    +480        self.directory_block: FileBlockInfo
    +481        self.file_log_block: FileBlockInfo
    +482        self.unknown_blocks: list = []
    +>>>>>>> origin/master
     483        for block_type, size, start in parse_directory(filebytes, self.start, self.num_blocks):
     484            block = FileBlockInfo(block_type=block_type, size=size, start=start)
     485            if block.is_data_status():
    @@ -2265,6 +2465,7 @@ 
    Attributes:
    492 self.directory_block = block 493 elif block.is_file_log(): 494 self.file_log_block = block +<<<<<<< HEAD 495 elif block.is_valid(): 496 self.data_blocks.append(block) 497 self.data_and_status_block_pairs = [] @@ -2289,6 +2490,35 @@
    Attributes:
    516 warnings.warn(text) 517 else: 518 self.data_and_status_block_pairs.append((data_block, status_matches[0])) +======= +495 elif block.is_data(): +496 self.data_blocks.append(block) +497 else: +498 block.bytes = filebytes[block.start:block.start + block.size] +499 self.unknown_blocks.append(block) +500 self.data_and_status_block_pairs = [] +501 self._pair_data_and_status_blocks() +502 +503 def __str__(self): +504 data_keys = [b.get_data_key() for b in self.data_blocks] +505 data_str = ', '.join(data_keys) +506 return 'File Directory: ' + str(self.num_blocks) + ' total blocks; data blocks: (' + data_str + ')' +507 +508 def _pair_data_and_status_blocks(self): +509 for data_block in self.data_blocks: +510 status_matches = [block for block in self.data_status_blocks if block.is_data_status_match(data_block)] +511 if len(status_matches) == 0: +512 text = 'Warning: No data status block match for data block: ' + str(data_block) \ +513 + '\n\tdata block will be ignored.' +514 warnings.warn(text) +515 elif len(status_matches) > 1: +516 text = 'Warning: Multiple data status block matches for data block: ' + str(data_block) \ +517 + '\n\tMatches:' + '; '.join([str(match) for match in status_matches]) \ +518 + '\n\tdata block will be ignored.' +519 warnings.warn(text) +520 else: +521 self.data_and_status_block_pairs.append((data_block, status_matches[0])) +>>>>>>> origin/master
    @@ -2322,6 +2552,7 @@
    Attributes:
  • file_log_block: FileBlockInfo of the file log (changes, etc.)
  • data_and_status_block_pairs: (data: FileBlockInfo, data_status: FileBlockInfo) which pairs the data status parameter block (time, x units, y units, etc.) with the data block it informs
  • +
  • unknown_blocks: list of FileBlockInfo with an unrecognized type (i.e. not sure how to parse)
  • @@ -2336,6 +2567,7 @@
    Attributes:
    +<<<<<<< HEAD
    475    def __init__(self, filebytes: bytes):
     476        self.version, self.start, self.max_blocks, self.num_blocks = parse_header(filebytes)
     477        self.data_blocks: list = []
    @@ -2344,6 +2576,17 @@ 
    Attributes:
    480 self.rf_param_blocks: list = [] 481 self.directory_block: FileBlockInfo 482 self.file_log_block: FileBlockInfo +======= +
    474    def __init__(self, filebytes: bytes):
    +475        self.version, self.start, self.max_blocks, self.num_blocks = parse_header(filebytes)
    +476        self.data_blocks: list = []
    +477        self.data_status_blocks: list = []
    +478        self.param_blocks: list = []
    +479        self.rf_param_blocks: list = []
    +480        self.directory_block: FileBlockInfo
    +481        self.file_log_block: FileBlockInfo
    +482        self.unknown_blocks: list = []
    +>>>>>>> origin/master
     483        for block_type, size, start in parse_directory(filebytes, self.start, self.num_blocks):
     484            block = FileBlockInfo(block_type=block_type, size=size, start=start)
     485            if block.is_data_status():
    @@ -2356,10 +2599,20 @@ 
    Attributes:
    492 self.directory_block = block 493 elif block.is_file_log(): 494 self.file_log_block = block +<<<<<<< HEAD 495 elif block.is_valid(): 496 self.data_blocks.append(block) 497 self.data_and_status_block_pairs = [] 498 self._pair_data_and_status_blocks() +======= +495 elif block.is_data(): +496 self.data_blocks.append(block) +497 else: +498 block.bytes = filebytes[block.start:block.start + block.size] +499 self.unknown_blocks.append(block) +500 self.data_and_status_block_pairs = [] +501 self._pair_data_and_status_blocks() +>>>>>>> origin/master
    @@ -2431,6 +2684,17 @@
    Attributes:
    +
    +
    +
    + unknown_blocks: list + + +
    + + + +
    diff --git a/docs/brukeropus/file/utils.html b/docs/brukeropus/file/utils.html index 0d3174a..cba6037 100644 --- a/docs/brukeropus/file/utils.html +++ b/docs/brukeropus/file/utils.html @@ -270,7 +270,7 @@

    199 param_col_labels = ('Key', 'Friendly Name', 'Value') 200 if block_info[0] != (0, 0, 0, 13, 0, 0): 201 _print_block_header(get_block_type_label(block_info[0]), width) -202 if block_info[0][2] > 0: +202 if block_info[0][2] > 0 or block_info[0] == (0, 0, 0, 0, 0, 1): 203 _print_cols(param_col_labels, param_col_widths) 204 for key, val in parse_param_block(filebytes, block_info[1], block_info[2]): 205 _print_cols((key, get_param_label(key), val), param_col_widths) @@ -284,12 +284,12 @@

    213 _print_centered('Num Blocks: ' + str(data['num_blocks']), width) 214 _print_centered('Store Table: ' + str(data['store_table']), width) 215 print(data['y']) -216 elif block_info[0] == (0, 0, 0, 0, 0, 0): -217 _print_centered('Undefined Block Type: Raw Bytes', width) -218 print(filebytes[block_info[1]: block_info[1] + block_info[2]]) +216 elif block_info[0][0] > 0 and block_info[0][1] > 0 and block_info[0][2] == 0 and block_info[0][3] > 0: +217 array = parse_data_block(filebytes, block_info[1], block_info[2]) +218 print(array) 219 else: -220 array = parse_data_block(filebytes, block_info[1], block_info[2]) -221 print(array) +220 _print_centered('Undefined Block Type: Raw Bytes', width) +221 print(filebytes[block_info[2]: block_info[2] + block_info[1]]) 222 223 224def _print_cols(vals, col_widths,): diff --git a/docs/search.js b/docs/search.js index 3d659f3..f176bbe 100644 --- a/docs/search.js +++ b/docs/search.js @@ -1,6 +1,10 @@ window.pdocSearch = (function(){ /** elasticlunr - http://weixsong.github.io * Copyright (C) 2017 Oliver Nightingale * Copyright (C) 2017 Wei Song * MIT Licensed */!function(){function e(e){if(null===e||"object"!=typeof e)return e;var t=e.constructor();for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.9.5",lunr=t,t.utils={},t.utils.warn=function(e){return function(t){e.console&&console.warn&&console.warn(t)}}(this),t.utils.toString=function(e){return void 0===e||null===e?"":e.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var e=Array.prototype.slice.call(arguments),t=e.pop(),n=e;if("function"!=typeof t)throw new TypeError("last argument must be a function");n.forEach(function(e){this.hasHandler(e)||(this.events[e]=[]),this.events[e].push(t)},this)},t.EventEmitter.prototype.removeListener=function(e,t){if(this.hasHandler(e)){var n=this.events[e].indexOf(t);-1!==n&&(this.events[e].splice(n,1),0==this.events[e].length&&delete this.events[e])}},t.EventEmitter.prototype.emit=function(e){if(this.hasHandler(e)){var t=Array.prototype.slice.call(arguments,1);this.events[e].forEach(function(e){e.apply(void 0,t)},this)}},t.EventEmitter.prototype.hasHandler=function(e){return e in this.events},t.tokenizer=function(e){if(!arguments.length||null===e||void 0===e)return[];if(Array.isArray(e)){var n=e.filter(function(e){return null===e||void 0===e?!1:!0});n=n.map(function(e){return t.utils.toString(e).toLowerCase()});var i=[];return n.forEach(function(e){var n=e.split(t.tokenizer.seperator);i=i.concat(n)},this),i}return e.toString().trim().toLowerCase().split(t.tokenizer.seperator)},t.tokenizer.defaultSeperator=/[\s\-]+/,t.tokenizer.seperator=t.tokenizer.defaultSeperator,t.tokenizer.setSeperator=function(e){null!==e&&void 0!==e&&"object"==typeof e&&(t.tokenizer.seperator=e)},t.tokenizer.resetSeperator=function(){t.tokenizer.seperator=t.tokenizer.defaultSeperator},t.tokenizer.getSeperator=function(){return t.tokenizer.seperator},t.Pipeline=function(){this._queue=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in t.Pipeline.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[n]=e},t.Pipeline.getRegisteredFunction=function(e){return e in t.Pipeline.registeredFunctions!=!0?null:t.Pipeline.registeredFunctions[e]},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.getRegisteredFunction(e);if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._queue.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._queue.indexOf(e);if(-1===i)throw new Error("Cannot find existingFn");this._queue.splice(i+1,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._queue.indexOf(e);if(-1===i)throw new Error("Cannot find existingFn");this._queue.splice(i,0,n)},t.Pipeline.prototype.remove=function(e){var t=this._queue.indexOf(e);-1!==t&&this._queue.splice(t,1)},t.Pipeline.prototype.run=function(e){for(var t=[],n=e.length,i=this._queue.length,o=0;n>o;o++){for(var r=e[o],s=0;i>s&&(r=this._queue[s](r,o,e),void 0!==r&&null!==r);s++);void 0!==r&&null!==r&&t.push(r)}return t},t.Pipeline.prototype.reset=function(){this._queue=[]},t.Pipeline.prototype.get=function(){return this._queue},t.Pipeline.prototype.toJSON=function(){return this._queue.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.DocumentStore,this.index={},this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var e=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,e)},t.Index.prototype.off=function(e,t){return this.eventEmitter.removeListener(e,t)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;n._fields=e.fields,n._ref=e.ref,n.documentStore=t.DocumentStore.load(e.documentStore),n.pipeline=t.Pipeline.load(e.pipeline),n.index={};for(var i in e.index)n.index[i]=t.InvertedIndex.load(e.index[i]);return n},t.Index.prototype.addField=function(e){return this._fields.push(e),this.index[e]=new t.InvertedIndex,this},t.Index.prototype.setRef=function(e){return this._ref=e,this},t.Index.prototype.saveDocument=function(e){return this.documentStore=new t.DocumentStore(e),this},t.Index.prototype.addDoc=function(e,n){if(e){var n=void 0===n?!0:n,i=e[this._ref];this.documentStore.addDoc(i,e),this._fields.forEach(function(n){var o=this.pipeline.run(t.tokenizer(e[n]));this.documentStore.addFieldLength(i,n,o.length);var r={};o.forEach(function(e){e in r?r[e]+=1:r[e]=1},this);for(var s in r){var u=r[s];u=Math.sqrt(u),this.index[n].addToken(s,{ref:i,tf:u})}},this),n&&this.eventEmitter.emit("add",e,this)}},t.Index.prototype.removeDocByRef=function(e){if(e&&this.documentStore.isDocStored()!==!1&&this.documentStore.hasDoc(e)){var t=this.documentStore.getDoc(e);this.removeDoc(t,!1)}},t.Index.prototype.removeDoc=function(e,n){if(e){var n=void 0===n?!0:n,i=e[this._ref];this.documentStore.hasDoc(i)&&(this.documentStore.removeDoc(i),this._fields.forEach(function(n){var o=this.pipeline.run(t.tokenizer(e[n]));o.forEach(function(e){this.index[n].removeToken(e,i)},this)},this),n&&this.eventEmitter.emit("remove",e,this))}},t.Index.prototype.updateDoc=function(e,t){var t=void 0===t?!0:t;this.removeDocByRef(e[this._ref],!1),this.addDoc(e,!1),t&&this.eventEmitter.emit("update",e,this)},t.Index.prototype.idf=function(e,t){var n="@"+t+"/"+e;if(Object.prototype.hasOwnProperty.call(this._idfCache,n))return this._idfCache[n];var i=this.index[t].getDocFreq(e),o=1+Math.log(this.documentStore.length/(i+1));return this._idfCache[n]=o,o},t.Index.prototype.getFields=function(){return this._fields.slice()},t.Index.prototype.search=function(e,n){if(!e)return[];e="string"==typeof e?{any:e}:JSON.parse(JSON.stringify(e));var i=null;null!=n&&(i=JSON.stringify(n));for(var o=new t.Configuration(i,this.getFields()).get(),r={},s=Object.keys(e),u=0;u0&&t.push(e);for(var i in n)"docs"!==i&&"df"!==i&&this.expandToken(e+i,t,n[i]);return t},t.InvertedIndex.prototype.toJSON=function(){return{root:this.root}},t.Configuration=function(e,n){var e=e||"";if(void 0==n||null==n)throw new Error("fields should not be null");this.config={};var i;try{i=JSON.parse(e),this.buildUserConfig(i,n)}catch(o){t.utils.warn("user configuration parse failed, will use default configuration"),this.buildDefaultConfig(n)}},t.Configuration.prototype.buildDefaultConfig=function(e){this.reset(),e.forEach(function(e){this.config[e]={boost:1,bool:"OR",expand:!1}},this)},t.Configuration.prototype.buildUserConfig=function(e,n){var i="OR",o=!1;if(this.reset(),"bool"in e&&(i=e.bool||i),"expand"in e&&(o=e.expand||o),"fields"in e)for(var r in e.fields)if(n.indexOf(r)>-1){var s=e.fields[r],u=o;void 0!=s.expand&&(u=s.expand),this.config[r]={boost:s.boost||0===s.boost?s.boost:1,bool:s.bool||i,expand:u}}else t.utils.warn("field name in user configuration not found in index instance fields");else this.addAllFields2UserConfig(i,o,n)},t.Configuration.prototype.addAllFields2UserConfig=function(e,t,n){n.forEach(function(n){this.config[n]={boost:1,bool:e,expand:t}},this)},t.Configuration.prototype.get=function(){return this.config},t.Configuration.prototype.reset=function(){this.config={}},lunr.SortedSet=function(){this.length=0,this.elements=[]},lunr.SortedSet.load=function(e){var t=new this;return t.elements=e,t.length=e.length,t},lunr.SortedSet.prototype.add=function(){var e,t;for(e=0;e1;){if(r===e)return o;e>r&&(t=o),r>e&&(n=o),i=n-t,o=t+Math.floor(i/2),r=this.elements[o]}return r===e?o:-1},lunr.SortedSet.prototype.locationFor=function(e){for(var t=0,n=this.elements.length,i=n-t,o=t+Math.floor(i/2),r=this.elements[o];i>1;)e>r&&(t=o),r>e&&(n=o),i=n-t,o=t+Math.floor(i/2),r=this.elements[o];return r>e?o:e>r?o+1:void 0},lunr.SortedSet.prototype.intersect=function(e){for(var t=new lunr.SortedSet,n=0,i=0,o=this.length,r=e.length,s=this.elements,u=e.elements;;){if(n>o-1||i>r-1)break;s[n]!==u[i]?s[n]u[i]&&i++:(t.add(s[n]),n++,i++)}return t},lunr.SortedSet.prototype.clone=function(){var e=new lunr.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},lunr.SortedSet.prototype.union=function(e){var t,n,i;this.length>=e.length?(t=this,n=e):(t=e,n=this),i=t.clone();for(var o=0,r=n.toArray();obrukeropus is a Python package for interacting with Bruker's OPUS spectroscopy software. Currently, the package can\nread OPUS data files and communicate/control OPUS software using the DDE communication protocol)

    \n\n

    Installation

    \n\n

    brukeropus requires python 3.6+ and numpy, but matplotlib is needed to run the plotting examples. You can\ninstall with pip:

    \n\n
    \n
    pip install brukeropus\n
    \n
    \n\n

    Namespace

    \n\n

    brukeropus provides direct imports to the following:

    \n\n
    \n
    from brukeropus import find_opus_files, read_opus, OPUSFile, Opus\n
    \n
    \n\n

    All other file functions or classes can be directly imported from the brukeropus.file or brukeropus.control\nsubmodules, e.g.:

    \n\n
    \n
    from brukeropus.file import parse_file_and_print\n
    \n
    \n\n

    It is recommended that you do not import from the fully qualified namespace, e.g.:

    \n\n
    \n
    from brukeropus.file.utils import parse_file_and_print\n
    \n
    \n\n

    as that namespace is subject to change. Instead import directly from brukeropus or its first level submodules.

    \n\n

    Reading OPUS Files (Basic Usage)

    \n\n
    \n
    from brukeropus import read_opus\nfrom matplotlib import pyplot as plt\n\nopus_file = read_opus('file.0')  # Returns an OPUSFile class\n\nopus_file.print_parameters()  # Pretty prints all metadata in the file to the console\n\nif 'a' in opus_file.data_keys:  # If absorbance spectra was extracted from file\n    plt.plot(opus_file.a.x, opus_file.a.y)  # Plot absorbance spectra\n    plt.title(opus_file.sfm + ' - ' + opus_file.snm)  # Sets plot title to Sample Form - Sample Name\n    plt.show()  # Display plot\n
    \n
    \n\n

    More detailed documentation on the file submodule can be found in brukeropus.file

    \n\n

    Controlling OPUS Software (Basic Usage)

    \n\n
    \n
    from brukeropus import opus, read_opus\nfrom matplotlib import pyplot as plt\n\nopus = Opus()  # Connects to actively running OPUS software\n\napt_options = opus.get_param_options('apt') # Get all valid aperture settings\n\nfor apt in apt_options[2:-2]: # Loop over all but the two smallest and two largest aperature settings\n    filepath = opus.measure_sample(apt=apt, nss=10, unload=True) # Perform measurement and unload file from OPUS\n    data = read_opus(filepath) # Read OPUS file from measurement\n    plt.plot(data.sm.x, data.sm.y, label=apt) # Plot single-channel sample spectra\nplt.legend()\nplt.show()\n
    \n
    \n\n

    More detailed documentation on the control submodule can be found in brukeropus.control.

    \n"}, {"fullname": "brukeropus.control", "modulename": "brukeropus.control", "kind": "module", "doc": "

    The brukeropus.control submodule of brukeropus includes the Opus class for communicating with OPUS software. The\nOpus class currently supports communication through the Dynamic Data Exchange (DDE) protocol. This class can be used\nto script measurement sweeps and perform various low-level operations (e.g. move mirrors, rotate polarizers, etc.). In\norder to communicate with OPUS, the software must be open, logged in, and running on the same PC as brukeropus.

    \n\n

    Initializing/verifying connection to OPUS Software

    \n\n
    \n
    from brukeropus import Opus\n\nopus = Opus()  # initialization of class automatically connects to open OPUS software\nprint(opus.get_version())  # prints the current OPUS software version\n
    \n
    \n\n

    Get information about a parameter (e.g. DTC, APT, VEL).

    \n\n
    \n
    opus = Opus()\nparam = 'vel'\nprint(opus.get_param_label(param))\nprint(opus.get_param_options(param))\n
    \n
    \n\n

    Perform a measurement sweep

    \n\n
    \n
    from brukeropus import opus, read_opus\nfrom matplotlib import pyplot as plt\n\nopus = Opus()  # Connects to actively running OPUS software\n\napt_options = opus.get_param_options('apt') # Get all valid aperture settings\n\nfor apt in apt_options[2:-2]: # Loop over all but the two smallest and two largest aperature settings\n    filepath = opus.measure_sample(apt=apt, nss=10, unload=True) # Perform measurement and unload file from OPUS\n    data = read_opus(filepath) # Read OPUS file from measurement\n    plt.plot(data.sm.x, data.sm.y, label=apt) # Plot single-channel sample spectra\nplt.legend()\nplt.show()\n
    \n
    \n\n

    For complete Opus documentation, see: brukeropus.control.opus

    \n"}, {"fullname": "brukeropus.control.dde", "modulename": "brukeropus.control.dde", "kind": "module", "doc": "

    \n"}, {"fullname": "brukeropus.control.dde.HCONV", "modulename": "brukeropus.control.dde", "qualname": "HCONV", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.c_void_p'>"}, {"fullname": "brukeropus.control.dde.HDDEDATA", "modulename": "brukeropus.control.dde", "qualname": "HDDEDATA", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.c_void_p'>"}, {"fullname": "brukeropus.control.dde.HSZ", "modulename": "brukeropus.control.dde", "qualname": "HSZ", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.c_void_p'>"}, {"fullname": "brukeropus.control.dde.LPBYTE", "modulename": "brukeropus.control.dde", "qualname": "LPBYTE", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.c_char_p'>"}, {"fullname": "brukeropus.control.dde.LPDWORD", "modulename": "brukeropus.control.dde", "qualname": "LPDWORD", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.wintypes.LP_c_ulong'>"}, {"fullname": "brukeropus.control.dde.LPSTR", "modulename": "brukeropus.control.dde", "qualname": "LPSTR", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.c_char_p'>"}, {"fullname": "brukeropus.control.dde.ULONG_PTR", "modulename": "brukeropus.control.dde", "qualname": "ULONG_PTR", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.c_ulong'>"}, {"fullname": "brukeropus.control.dde.PCONVCONTEXT", "modulename": "brukeropus.control.dde", "qualname": "PCONVCONTEXT", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.c_void_p'>"}, {"fullname": "brukeropus.control.dde.DMLERR_NO_ERROR", "modulename": "brukeropus.control.dde", "qualname": "DMLERR_NO_ERROR", "kind": "variable", "doc": "

    \n", "default_value": "0"}, {"fullname": "brukeropus.control.dde.CF_TEXT", "modulename": "brukeropus.control.dde", "qualname": "CF_TEXT", "kind": "variable", "doc": "

    \n", "default_value": "1"}, {"fullname": "brukeropus.control.dde.CF_BITMAP", "modulename": "brukeropus.control.dde", "qualname": "CF_BITMAP", "kind": "variable", "doc": "

    \n", "default_value": "2"}, {"fullname": "brukeropus.control.dde.CF_METAFILEPICT", "modulename": "brukeropus.control.dde", "qualname": "CF_METAFILEPICT", "kind": "variable", "doc": "

    \n", "default_value": "3"}, {"fullname": "brukeropus.control.dde.CF_SYLK", "modulename": "brukeropus.control.dde", "qualname": "CF_SYLK", "kind": "variable", "doc": "

    \n", "default_value": "4"}, {"fullname": "brukeropus.control.dde.CF_DIF", "modulename": "brukeropus.control.dde", "qualname": "CF_DIF", "kind": "variable", "doc": "

    \n", "default_value": "5"}, {"fullname": "brukeropus.control.dde.CF_TIFF", "modulename": "brukeropus.control.dde", "qualname": "CF_TIFF", "kind": "variable", "doc": "

    \n", "default_value": "6"}, {"fullname": "brukeropus.control.dde.CF_OEMTEXT", "modulename": "brukeropus.control.dde", "qualname": "CF_OEMTEXT", "kind": "variable", "doc": "

    \n", "default_value": "7"}, {"fullname": "brukeropus.control.dde.CF_DIB", "modulename": "brukeropus.control.dde", "qualname": "CF_DIB", "kind": "variable", "doc": "

    \n", "default_value": "8"}, {"fullname": "brukeropus.control.dde.CF_PALETTE", "modulename": "brukeropus.control.dde", "qualname": "CF_PALETTE", "kind": "variable", "doc": "

    \n", "default_value": "9"}, {"fullname": "brukeropus.control.dde.CF_PENDATA", "modulename": "brukeropus.control.dde", "qualname": "CF_PENDATA", "kind": "variable", "doc": "

    \n", "default_value": "10"}, {"fullname": "brukeropus.control.dde.CF_RIFF", "modulename": "brukeropus.control.dde", "qualname": "CF_RIFF", "kind": "variable", "doc": "

    \n", "default_value": "11"}, {"fullname": "brukeropus.control.dde.CF_WAVE", "modulename": "brukeropus.control.dde", "qualname": "CF_WAVE", "kind": "variable", "doc": "

    \n", "default_value": "12"}, {"fullname": "brukeropus.control.dde.CF_UNICODETEXT", "modulename": "brukeropus.control.dde", "qualname": "CF_UNICODETEXT", "kind": "variable", "doc": "

    \n", "default_value": "13"}, {"fullname": "brukeropus.control.dde.CF_ENHMETAFILE", "modulename": "brukeropus.control.dde", "qualname": "CF_ENHMETAFILE", "kind": "variable", "doc": "

    \n", "default_value": "14"}, {"fullname": "brukeropus.control.dde.CF_HDROP", "modulename": "brukeropus.control.dde", "qualname": "CF_HDROP", "kind": "variable", "doc": "

    \n", "default_value": "15"}, {"fullname": "brukeropus.control.dde.CF_LOCALE", "modulename": "brukeropus.control.dde", "qualname": "CF_LOCALE", "kind": "variable", "doc": "

    \n", "default_value": "16"}, {"fullname": "brukeropus.control.dde.CF_DIBV5", "modulename": "brukeropus.control.dde", "qualname": "CF_DIBV5", "kind": "variable", "doc": "

    \n", "default_value": "17"}, {"fullname": "brukeropus.control.dde.CF_MAX", "modulename": "brukeropus.control.dde", "qualname": "CF_MAX", "kind": "variable", "doc": "

    \n", "default_value": "18"}, {"fullname": "brukeropus.control.dde.DDE_FACK", "modulename": "brukeropus.control.dde", "qualname": "DDE_FACK", "kind": "variable", "doc": "

    \n", "default_value": "32768"}, {"fullname": "brukeropus.control.dde.DDE_FBUSY", "modulename": "brukeropus.control.dde", "qualname": "DDE_FBUSY", "kind": "variable", "doc": "

    \n", "default_value": "16384"}, {"fullname": "brukeropus.control.dde.DDE_FDEFERUPD", "modulename": "brukeropus.control.dde", "qualname": "DDE_FDEFERUPD", "kind": "variable", "doc": "

    \n", "default_value": "16384"}, {"fullname": "brukeropus.control.dde.DDE_FACKREQ", "modulename": "brukeropus.control.dde", "qualname": "DDE_FACKREQ", "kind": "variable", "doc": "

    \n", "default_value": "32768"}, {"fullname": "brukeropus.control.dde.DDE_FRELEASE", "modulename": "brukeropus.control.dde", "qualname": "DDE_FRELEASE", "kind": "variable", "doc": "

    \n", "default_value": "8192"}, {"fullname": "brukeropus.control.dde.DDE_FREQUESTED", "modulename": "brukeropus.control.dde", "qualname": "DDE_FREQUESTED", "kind": "variable", "doc": "

    \n", "default_value": "4096"}, {"fullname": "brukeropus.control.dde.DDE_FAPPSTATUS", "modulename": "brukeropus.control.dde", "qualname": "DDE_FAPPSTATUS", "kind": "variable", "doc": "

    \n", "default_value": "255"}, {"fullname": "brukeropus.control.dde.DDE_FNOTPROCESSED", "modulename": "brukeropus.control.dde", "qualname": "DDE_FNOTPROCESSED", "kind": "variable", "doc": "

    \n", "default_value": "0"}, {"fullname": "brukeropus.control.dde.DDE_FACKRESERVED", "modulename": "brukeropus.control.dde", "qualname": "DDE_FACKRESERVED", "kind": "variable", "doc": "

    \n", "default_value": "-49408"}, {"fullname": "brukeropus.control.dde.DDE_FADVRESERVED", "modulename": "brukeropus.control.dde", "qualname": "DDE_FADVRESERVED", "kind": "variable", "doc": "

    \n", "default_value": "-49153"}, {"fullname": "brukeropus.control.dde.DDE_FDATRESERVED", "modulename": "brukeropus.control.dde", "qualname": "DDE_FDATRESERVED", "kind": "variable", "doc": "

    \n", "default_value": "-45057"}, {"fullname": "brukeropus.control.dde.DDE_FPOKRESERVED", "modulename": "brukeropus.control.dde", "qualname": "DDE_FPOKRESERVED", "kind": "variable", "doc": "

    \n", "default_value": "-8193"}, {"fullname": "brukeropus.control.dde.XTYPF_NOBLOCK", "modulename": "brukeropus.control.dde", "qualname": "XTYPF_NOBLOCK", "kind": "variable", "doc": "

    \n", "default_value": "2"}, {"fullname": "brukeropus.control.dde.XTYPF_NODATA", "modulename": "brukeropus.control.dde", "qualname": "XTYPF_NODATA", "kind": "variable", "doc": "

    \n", "default_value": "4"}, {"fullname": "brukeropus.control.dde.XTYPF_ACKREQ", "modulename": "brukeropus.control.dde", "qualname": "XTYPF_ACKREQ", "kind": "variable", "doc": "

    \n", "default_value": "8"}, {"fullname": "brukeropus.control.dde.XCLASS_MASK", "modulename": "brukeropus.control.dde", "qualname": "XCLASS_MASK", "kind": "variable", "doc": "

    \n", "default_value": "64512"}, {"fullname": "brukeropus.control.dde.XCLASS_BOOL", "modulename": "brukeropus.control.dde", "qualname": "XCLASS_BOOL", "kind": "variable", "doc": "

    \n", "default_value": "4096"}, {"fullname": "brukeropus.control.dde.XCLASS_DATA", "modulename": "brukeropus.control.dde", "qualname": "XCLASS_DATA", "kind": "variable", "doc": "

    \n", "default_value": "8192"}, {"fullname": "brukeropus.control.dde.XCLASS_FLAGS", "modulename": "brukeropus.control.dde", "qualname": "XCLASS_FLAGS", "kind": "variable", "doc": "

    \n", "default_value": "16384"}, {"fullname": "brukeropus.control.dde.XCLASS_NOTIFICATION", "modulename": "brukeropus.control.dde", "qualname": "XCLASS_NOTIFICATION", "kind": "variable", "doc": "

    \n", "default_value": "32768"}, {"fullname": "brukeropus.control.dde.XTYP_ERROR", "modulename": "brukeropus.control.dde", "qualname": "XTYP_ERROR", "kind": "variable", "doc": "

    \n", "default_value": "32770"}, {"fullname": "brukeropus.control.dde.XTYP_ADVDATA", "modulename": "brukeropus.control.dde", "qualname": "XTYP_ADVDATA", "kind": "variable", "doc": "

    \n", "default_value": "16400"}, {"fullname": "brukeropus.control.dde.XTYP_ADVREQ", "modulename": "brukeropus.control.dde", "qualname": "XTYP_ADVREQ", "kind": "variable", "doc": "

    \n", "default_value": "8226"}, {"fullname": "brukeropus.control.dde.XTYP_ADVSTART", "modulename": "brukeropus.control.dde", "qualname": "XTYP_ADVSTART", "kind": "variable", "doc": "

    \n", "default_value": "4144"}, {"fullname": "brukeropus.control.dde.XTYP_ADVSTOP", "modulename": "brukeropus.control.dde", "qualname": "XTYP_ADVSTOP", "kind": "variable", "doc": "

    \n", "default_value": "32832"}, {"fullname": "brukeropus.control.dde.XTYP_EXECUTE", "modulename": "brukeropus.control.dde", "qualname": "XTYP_EXECUTE", "kind": "variable", "doc": "

    \n", "default_value": "16464"}, {"fullname": "brukeropus.control.dde.XTYP_CONNECT", "modulename": "brukeropus.control.dde", "qualname": "XTYP_CONNECT", "kind": "variable", "doc": "

    \n", "default_value": "4194"}, {"fullname": "brukeropus.control.dde.XTYP_CONNECT_CONFIRM", "modulename": "brukeropus.control.dde", "qualname": "XTYP_CONNECT_CONFIRM", "kind": "variable", "doc": "

    \n", "default_value": "32882"}, {"fullname": "brukeropus.control.dde.XTYP_XACT_COMPLETE", "modulename": "brukeropus.control.dde", "qualname": "XTYP_XACT_COMPLETE", "kind": "variable", "doc": "

    \n", "default_value": "32896"}, {"fullname": "brukeropus.control.dde.XTYP_POKE", "modulename": "brukeropus.control.dde", "qualname": "XTYP_POKE", "kind": "variable", "doc": "

    \n", "default_value": "16528"}, {"fullname": "brukeropus.control.dde.XTYP_REGISTER", "modulename": "brukeropus.control.dde", "qualname": "XTYP_REGISTER", "kind": "variable", "doc": "

    \n", "default_value": "32930"}, {"fullname": "brukeropus.control.dde.XTYP_REQUEST", "modulename": "brukeropus.control.dde", "qualname": "XTYP_REQUEST", "kind": "variable", "doc": "

    \n", "default_value": "8368"}, {"fullname": "brukeropus.control.dde.XTYP_DISCONNECT", "modulename": "brukeropus.control.dde", "qualname": "XTYP_DISCONNECT", "kind": "variable", "doc": "

    \n", "default_value": "32962"}, {"fullname": "brukeropus.control.dde.XTYP_UNREGISTER", "modulename": "brukeropus.control.dde", "qualname": "XTYP_UNREGISTER", "kind": "variable", "doc": "

    \n", "default_value": "32978"}, {"fullname": "brukeropus.control.dde.XTYP_WILDCONNECT", "modulename": "brukeropus.control.dde", "qualname": "XTYP_WILDCONNECT", "kind": "variable", "doc": "

    \n", "default_value": "8418"}, {"fullname": "brukeropus.control.dde.XTYP_MONITOR", "modulename": "brukeropus.control.dde", "qualname": "XTYP_MONITOR", "kind": "variable", "doc": "

    \n", "default_value": "33010"}, {"fullname": "brukeropus.control.dde.XTYP_MASK", "modulename": "brukeropus.control.dde", "qualname": "XTYP_MASK", "kind": "variable", "doc": "

    \n", "default_value": "240"}, {"fullname": "brukeropus.control.dde.XTYP_SHIFT", "modulename": "brukeropus.control.dde", "qualname": "XTYP_SHIFT", "kind": "variable", "doc": "

    \n", "default_value": "4"}, {"fullname": "brukeropus.control.dde.TIMEOUT_ASYNC", "modulename": "brukeropus.control.dde", "qualname": "TIMEOUT_ASYNC", "kind": "variable", "doc": "

    \n", "default_value": "4294967295"}, {"fullname": "brukeropus.control.dde.get_winfunc", "modulename": "brukeropus.control.dde", "qualname": "get_winfunc", "kind": "function", "doc": "

    Retrieve a function from a library, and set the data types.

    \n", "signature": "(\tlibname,\tfuncname,\trestype=None,\targtypes=(),\t_libcache={'user32': <WinDLL 'user32', handle 7fffa9710000>}):", "funcdef": "def"}, {"fullname": "brukeropus.control.dde.DDECALLBACK", "modulename": "brukeropus.control.dde", "qualname": "DDECALLBACK", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.WINFUNCTYPE.<locals>.WinFunctionType'>"}, {"fullname": "brukeropus.control.dde.DDE", "modulename": "brukeropus.control.dde", "qualname": "DDE", "kind": "class", "doc": "

    Object containing all the DDE functions

    \n"}, {"fullname": "brukeropus.control.dde.DDE.AccessData", "modulename": "brukeropus.control.dde", "qualname": "DDE.AccessData", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.ClientTransaction", "modulename": "brukeropus.control.dde", "qualname": "DDE.ClientTransaction", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.Connect", "modulename": "brukeropus.control.dde", "qualname": "DDE.Connect", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.CreateStringHandle", "modulename": "brukeropus.control.dde", "qualname": "DDE.CreateStringHandle", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.Disconnect", "modulename": "brukeropus.control.dde", "qualname": "DDE.Disconnect", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.GetLastError", "modulename": "brukeropus.control.dde", "qualname": "DDE.GetLastError", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.Initialize", "modulename": "brukeropus.control.dde", "qualname": "DDE.Initialize", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.FreeDataHandle", "modulename": "brukeropus.control.dde", "qualname": "DDE.FreeDataHandle", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.FreeStringHandle", "modulename": "brukeropus.control.dde", "qualname": "DDE.FreeStringHandle", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.QueryString", "modulename": "brukeropus.control.dde", "qualname": "DDE.QueryString", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.UnaccessData", "modulename": "brukeropus.control.dde", "qualname": "DDE.UnaccessData", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.Uninitialize", "modulename": "brukeropus.control.dde", "qualname": "DDE.Uninitialize", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDEError", "modulename": "brukeropus.control.dde", "qualname": "DDEError", "kind": "class", "doc": "

    Exception raise when a DDE errpr occures.

    \n", "bases": "builtins.RuntimeError"}, {"fullname": "brukeropus.control.dde.DDEError.__init__", "modulename": "brukeropus.control.dde", "qualname": "DDEError.__init__", "kind": "function", "doc": "

    \n", "signature": "(msg, idInst=None)"}, {"fullname": "brukeropus.control.dde.DDEClient", "modulename": "brukeropus.control.dde", "qualname": "DDEClient", "kind": "class", "doc": "

    The DDEClient class.

    \n\n

    Use this class to create and manage a connection to a service/topic. To get\nclassbacks subclass DDEClient and overwrite callback.

    \n"}, {"fullname": "brukeropus.control.dde.DDEClient.__init__", "modulename": "brukeropus.control.dde", "qualname": "DDEClient.__init__", "kind": "function", "doc": "

    Create a connection to a service/topic.

    \n", "signature": "(service, topic)"}, {"fullname": "brukeropus.control.dde.DDEClient.advise", "modulename": "brukeropus.control.dde", "qualname": "DDEClient.advise", "kind": "function", "doc": "

    Request updates when DDE data changes.

    \n", "signature": "(self, item, stop=False):", "funcdef": "def"}, {"fullname": "brukeropus.control.dde.DDEClient.execute", "modulename": "brukeropus.control.dde", "qualname": "DDEClient.execute", "kind": "function", "doc": "

    Execute a DDE command.

    \n", "signature": "(self, command, timeout=5000):", "funcdef": "def"}, {"fullname": "brukeropus.control.dde.DDEClient.request", "modulename": "brukeropus.control.dde", "qualname": "DDEClient.request", "kind": "function", "doc": "

    Request data from DDE service.

    \n", "signature": "(self, item, timeout=5000):", "funcdef": "def"}, {"fullname": "brukeropus.control.dde.DDEClient.callback", "modulename": "brukeropus.control.dde", "qualname": "DDEClient.callback", "kind": "function", "doc": "

    Calback function for advice.

    \n", "signature": "(self, value, item=None):", "funcdef": "def"}, {"fullname": "brukeropus.control.dde.WinMSGLoop", "modulename": "brukeropus.control.dde", "qualname": "WinMSGLoop", "kind": "function", "doc": "

    Run the main windows message loop.

    \n", "signature": "():", "funcdef": "def"}, {"fullname": "brukeropus.control.opus", "modulename": "brukeropus.control.opus", "kind": "module", "doc": "

    \n"}, {"fullname": "brukeropus.control.opus.ERROR_CODES", "modulename": "brukeropus.control.opus", "qualname": "ERROR_CODES", "kind": "variable", "doc": "

    \n", "default_value": "{1: 'Not an Opus Command', 2: 'Unknown Opus Command', 3: 'Missing Square Bracket in Command', 4: 'Function Not Available (Possible missing parameter)', 5: 'Parameter Name Is Incorrect', 6: 'Parameter Set Is Incomplete', 7: 'File Parameter Is Incorrectly Formatted', 8: 'File(s) Missing Or Corrupt', 9: 'Opus Could Not Complete The Command'}"}, {"fullname": "brukeropus.control.opus.Opus", "modulename": "brukeropus.control.opus", "qualname": "Opus", "kind": "class", "doc": "

    Class for communicating with currently running OPUS software using DDE interface. Class automatically attempts\nto connect to OPUS software upon initialization.

    \n"}, {"fullname": "brukeropus.control.opus.Opus.dde", "modulename": "brukeropus.control.opus", "qualname": "Opus.dde", "kind": "variable", "doc": "

    \n", "default_value": "None"}, {"fullname": "brukeropus.control.opus.Opus.connected", "modulename": "brukeropus.control.opus", "qualname": "Opus.connected", "kind": "variable", "doc": "

    \n", "default_value": "False"}, {"fullname": "brukeropus.control.opus.Opus.error_string", "modulename": "brukeropus.control.opus", "qualname": "Opus.error_string", "kind": "variable", "doc": "

    \n", "default_value": "'Error'"}, {"fullname": "brukeropus.control.opus.Opus.connect", "modulename": "brukeropus.control.opus", "qualname": "Opus.connect", "kind": "function", "doc": "

    Connects class to OPUS software through the DDE interface. Sets the connected attribute to True if\nsuccessful. By default, initializing an Opus class will automatically attempt to connect to OPUS.

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.disconnect", "modulename": "brukeropus.control.opus", "qualname": "Opus.disconnect", "kind": "function", "doc": "

    Disconnects DDE client/server connection.

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.raw_query", "modulename": "brukeropus.control.opus", "qualname": "Opus.raw_query", "kind": "function", "doc": "

    Sends command/request string (req_str) to OPUS and returns the response in byte format.

    \n\n
    Arguments:
    \n\n
      \n
    • req_str: The request string to send to OPUS over DDE
    • \n
    • timeout: timeout in milliseconds. If a response is not recieved within the timeout period, an exception is\nraised.
    • \n
    \n\n
    Returns:
    \n\n
    \n

    response: response from OPUS software through DDE request in bytes format.

    \n
    \n", "signature": "(self, req_str: str, timeout=10000):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.parse_response", "modulename": "brukeropus.control.opus", "qualname": "Opus.parse_response", "kind": "function", "doc": "

    Parses the byte response from a raw DDE request query. If an error is detected in the request, an Exception\nis raised. If successful, a boolean, string or list of strings will be returned as appropriate.

    \n\n
    Arguments:
    \n\n
      \n
    • byte_response: response from OPUS software through DDE request in bytes format.
    • \n
    • decode: format used to decode bytes into string (e.g. 'ascii' or 'utf-8')
    • \n
    \n\n
    Returns:
    \n\n
    \n

    response: parsed response from OPUS software (bool, string, or list of strings depending on request)

    \n
    \n", "signature": "(self, byte_response: bytes, decode='ascii'):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.query", "modulename": "brukeropus.control.opus", "qualname": "Opus.query", "kind": "function", "doc": "

    Sends a command/request and returns the parsed response.

    \n\n
    Arguments:
    \n\n
      \n
    • req_str: The request string to send to OPUS over DDE
    • \n
    • timeout: timeout in milliseconds. If a response is not recieved within the timeout period, an exception is\nraised.
    • \n
    • decode: format used to decode bytes into string (e.g. 'ascii' or 'utf-8')
    • \n
    \n\n
    Returns:
    \n\n
    \n

    response: parsed response from OPUS software (bool, string, or list of strings depending on request)

    \n
    \n", "signature": "(self, req_str: str, timeout=10000, decode='ascii'):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.close_opus", "modulename": "brukeropus.control.opus", "qualname": "Opus.close_opus", "kind": "function", "doc": "

    Closes the OPUS application. Returns True if successful.

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.get_param_label", "modulename": "brukeropus.control.opus", "qualname": "Opus.get_param_label", "kind": "function", "doc": "

    Get the label for a three character parameter code (e.g. BMS, APT, DTC, etc...).

    \n\n
    Arguments:
    \n\n
      \n
    • param: three character parameter code (case insensitive)
    • \n
    \n\n
    Returns:
    \n\n
    \n

    label: short descriptive label that defines the parameter

    \n
    \n", "signature": "(self, param: str):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.get_param_options", "modulename": "brukeropus.control.opus", "qualname": "Opus.get_param_options", "kind": "function", "doc": "

    Get the parameter setting options for a three character parameter code. Only valid for\nenum type parameters (e.g. BMS, APT, DTC, etc...).

    \n\n
    Arguments:
    \n\n
      \n
    • param: three character parameter code (case insensitive)
    • \n
    \n\n
    Returns:
    \n\n
    \n

    options: list of valid options (strings) for the given parameter

    \n
    \n", "signature": "(self, param: str):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.get_version", "modulename": "brukeropus.control.opus", "qualname": "Opus.get_version", "kind": "function", "doc": "

    Get the OPUS software version information

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.get_opus_path", "modulename": "brukeropus.control.opus", "qualname": "Opus.get_opus_path", "kind": "function", "doc": "

    Get the absolute path to the OPUS software directory (where PARAMTEXT.bin and other instrument specific files\nare located)

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.send_command", "modulename": "brukeropus.control.opus", "qualname": "Opus.send_command", "kind": "function", "doc": "

    Used to send \"Direct Commands\" to the optics bench. Useful for manually moving motors, etc. from accessories\nand other low-level operations such as controlling the scanning mirror movement.

    \n\n
    Examples:
    \n\n
    \n

    send_command('VAC=5') # vents the sample compartment\n send_command('VAC=4') # evacuates sample compartment

    \n
    \n\n
    Arguments:
    \n\n
      \n
    • text_command: string command as you would enter into \"Direct Command\" input of OPUS
    • \n
    • timeout: timeout in milliseconds to wait for response
    • \n
    \n\n
    Returns:
    \n\n
    \n

    response: parsed response from OPUS software (typically boolean confirmation)

    \n
    \n", "signature": "(self, text_command: str, timeout=10000):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.evacuate_sample", "modulename": "brukeropus.control.opus", "qualname": "Opus.evacuate_sample", "kind": "function", "doc": "

    Evacuates the sample compartment

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.vent_sample", "modulename": "brukeropus.control.opus", "qualname": "Opus.vent_sample", "kind": "function", "doc": "

    Vents the sample compartment

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.close_flaps", "modulename": "brukeropus.control.opus", "qualname": "Opus.close_flaps", "kind": "function", "doc": "

    Closes vacumm flaps between optics bench and sample compartment

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.open_flaps", "modulename": "brukeropus.control.opus", "qualname": "Opus.open_flaps", "kind": "function", "doc": "

    Opens vacumm flaps between optics bench and sample compartment

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.unload_file", "modulename": "brukeropus.control.opus", "qualname": "Opus.unload_file", "kind": "function", "doc": "

    Unloads a file from the OPUS software from its filepath

    \n\n
    Arguments:
    \n\n
      \n
    • filepath: full path of the file to be unloaded in the software.
    • \n
    \n\n
    Returns:
    \n\n
    \n

    response: True if successful.

    \n
    \n", "signature": "(self, filepath: str):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.unload_all", "modulename": "brukeropus.control.opus", "qualname": "Opus.unload_all", "kind": "function", "doc": "

    Unloads all files from OPUS software

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.measure_ref", "modulename": "brukeropus.control.opus", "qualname": "Opus.measure_ref", "kind": "function", "doc": "

    Takes a reference measurement using the current settings from advanced experiment. Also\ntakes option **kwargs input which use the OPUS 3-letter parameter keys and values as input\nto customize the measurement. example:

    \n\n
    measure_ref(nrs=100, res=4) # measures reference with current settings but overriding averages to 100 and\n    resolution to 4\n
    \n\n
    Arguments:
    \n\n
      \n
    • timeout: timeout in milliseconds to wait for response
    • \n
    • kwargs: any valid three character parameter code (case insensitive)
    • \n
    \n\n
    Returns:
    \n\n
    \n

    response: True if successful

    \n
    \n", "signature": "(self, timeout=1000000, **kwargs):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.measure_sample", "modulename": "brukeropus.control.opus", "qualname": "Opus.measure_sample", "kind": "function", "doc": "

    Takes a reference measurement using the current settings from advanced experiment. Also\ntakes option **kwargs input which use the OPUS 3-letter parameter keys and values as input\nto customize the measurement. example:

    \n\n
    measure_sample(nss=100, res=4) # measures sample with current settings but overriding averages to 100 and\n    resolution to 4\n
    \n\n
    Arguments:
    \n\n
      \n
    • unload: whether to unload the file from OPUS after measurement is complete (to allow moving/renaming, etc.)
    • \n
    • timeout: timeout in milliseconds to wait for response
    • \n
    • kwargs: any valid three character parameter code (case insensitive)
    • \n
    \n\n
    Returns:
    \n\n
    \n

    filepath: absolute filepath to measured sample file

    \n
    \n", "signature": "(self, unload=False, timeout=1000000, **kwargs):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.check_signal", "modulename": "brukeropus.control.opus", "qualname": "Opus.check_signal", "kind": "function", "doc": "

    Performs a quick (typically 1 sample) measurement using the current FTIR settings. Current settings can be\noverridden using **kwargs. After measurement is finished, the file is unloaded from OPUS and deleted. The\nfunction returns an OPUSFile object before it deletes the quick measurement file.

    \n\n
    Arguments:
    \n\n
      \n
    • nss: number of sample scans to average (default is 1, i.e. no averaging)
    • \n
    • kwargs: any valid three character parameter code (case insensitive)
    • \n
    \n\n
    Returns:
    \n\n
    \n

    opus_file: OPUSFile object generated by quick measurement

    \n
    \n", "signature": "(self, nss=1, **kwargs):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.save_ref", "modulename": "brukeropus.control.opus", "qualname": "Opus.save_ref", "kind": "function", "doc": "

    Saves current reference to file (according to current filename and path set in advanced experiment) and\nreturns the filename.

    \n\n
    Returns:
    \n\n
    \n

    filepath: absolute path to saved reference file

    \n
    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file", "modulename": "brukeropus.file", "kind": "module", "doc": "

    The brukeropus.file submodule of brukeropus includes all the functions and classes for reading and exploring OPUS\nfiles. This includes both high-level functions like read_opus that returns an OPUSFile class, as well as low-level\nparsing functions like parse_directory that returns data extracted directly from the binary OPUS file bytes. This\noverview documentation will focus on the high-level functions which will be useful for most users. If you are\ninterested in using the low-level parsing functions, perhaps to make your own data class or customize how files are\nread, refer to: brukeropus.file.parser which contains all the low-level parsing functions.

    \n\n

    Finding OPUS Files

    \n\n

    OPUS files are typically saved with a numeric file extension (e.g. file.0, file.1, file.1001). This makes searching for\na list of OPUS files in a directory a little more cumbersome than a traditional \"*.csv\" search. To address this,\nbrukeropus includes a find_opus_files function:

    \n\n
    \n
    from brukeropus import find_opus_files\n\nfilepaths = find_opus_files(r'path\\to\\opus\\files', recursive=True)\n
    \n
    \n\n

    Which will assign a list of filepaths that match the numeric extension formatting of OPUS files. For full documentation,\nsee brukeropus.file.utils.find_opus_files.

    \n\n

    Reading OPUS Files

    \n\n

    brukeropus parses OPUS files and assembles them into an OPUSFile object that contains the extracted data (and\nmetadata) within the file. You can generate an OPUSFile object in one of two ways:

    \n\n
    \n
    from brukeropus import read_opus, OPUSFile\n\nfilepath = r'path\\to\\opusfile.0'\n\ndata = read_opus(filepath)\nsame_data = OPUSFile(filepath)\n
    \n
    \n\n

    In the above code, data and same_data are both OPUSFile objects with identical data.

    \n\n

    Using the OPUSFile Class

    \n\n

    OPUS files all start with the same first four magic bytes. If the file does not start with these bytes (i.e. is not\na valid OPUS file), the OPUSFile class will logically evaluate to false:

    \n\n
    \n
    data = read_opus('file.pdf')\nif data:\n    print(data)\nelse:\n    print(data.filepath, 'is not an OPUS file')\n
    \n
    \n\n

    To view all parameter metadata in the file, you can print to the console using the class method: print_parameters.\nThis will let you view all the key, value parameter data extracted from the file with labels for what the parameter keys\nare referring to wherever known.

    \n\n
    \n
    data = read_opus('file.0')\ndata.print_parameters()\n
    \n
    \n\n

    \nExample print_parameters Output

    \n\n

    \n

    \n
    ====================================================================================================\n                                         Optical Parameters\nKey    Label                                   Value\nACC    Accessory                               TRANS *010A984F\nAPR    ATR Pressure                            0\nAPT    Aperture Setting                        1 mm\nBMS    Beamsplitter                            KBr-Broadband\nCHN    Measurement Channel                     Sample Compartment\nDTC    Detector                                RT-DLaTGS [Internal Pos.1]\nHPF    High Pass Filter                        0\nLPF    Low Pass Filter                         10.0\nLPV    Variable Low Pass Filter (cm-1)         4000\nOPF    Optical Filter Setting                  Open\nPGN    Preamplifier Gain                       3\nRDX    Extended Ready Check                    0\nSRC    Source                                  MIR\nVEL    Scanner Velocity                        10.0\nADC    External Analog Signals                 0\nSON    External Sync                           Off\n\n====================================================================================================\n                                    Fourier Transform Parameters\nKey    Label                                   Value\nAPF    Apodization Function                    B3\nHFQ    End Frequency Limit for File            500.0\nLFQ    Start Frequency Limit for File          10000.0\nNLI    Nonlinearity Correction                 0\nPHR    Phase Resolution                        100.0\nPHZ    Phase Correction Mode                   ML\nSPZ    Stored Phase Mode                       NO\nZFF    Zero Filling Factor                     2\n\n====================================================================================================\n                                       Acquisition Parameters\nKey    Label                                   Value\nADT    Additional Data Treatment               0\nAQM    Acquisition Mode                        DD\nCFE    Low Intensity Power Mode with DTGS      0\nCOR    Correlation Test Mode                   0\nDEL    Delay Before Measurement                0\nDLY    Stabilization Delay                     0\nHFW    Wanted High Freq Limit                  15000.0\nLFW    Wanted Low Freq Limit                   0.0\nNSS    Number of Sample Scans                  50\nPLF    Result Spectrum Type                    AB\nRES    Resolution (cm-1)                       4.0\nSOT    Sample Scans or Time                    0\nTCL    Command Line for Additional Data Tr...\nTDL    To Do List                              16777271\nSGN    Sample Signal Gain                      1\n\n====================================================================================================\n                                      Sample Origin Parameters\nKey    Label                                   Value\nBLD    Building\nCNM    Operator Name                           Duran\nCPY    Company\nDPM    Department\nEXP    Experiment                              MWIR-LWIR_Trans_FileNameFormat.XPM\nLCT    Location\nSFM    Sample Form                             Atm-MWIR (All A)\nSNM    Sample Name                             File Test\nXPP    Experiment Path                         C:\\Users\\Public\\Documents\\Bruker\\OPUS_8.1.29\\XPM\nIST    Instrument Status                       OK\nCPG    Character Encoding Code Page            1252\nUID    Universally Unique Identifier           0d1348c2-3a2c-41c9-b521-bdaf0a23710c\n\n====================================================================================================\n                                    Instrument Status Parameters\nKey    Label                                   Value\nHFL    High Folding Limit                      15795.820598\nLFL    Low Folding Limit                       0.0\nLWN    Laser Wavenumber                        15795.820598\nABP    Absolute Peak Pos in Laser*2            52159\nSSP    Sample Spacing Divisor                  1\nASG    Actual Signal Gain                      1\nARG    Actual Reference Gain                   1\nASS    Number of Sample Scans                  50\nGFW    Number of Good Forward Scans            25\nGBW    Number of Good Backward Scans           25\nBFW    Number of Bad Forward Scans             0\nBBW    Number of Bad Backward Scans            0\nPKA    Peak Amplitude                          1409\nPKL    Peak Location                           7364\nPRA    Backward Peak Amplitude                 1356\nPRL    Backward Peak Location                  7363\nP2A    Peak Amplitude Channel 2                1\nP2L    Peak Location Channel 2                 1\nP2R    Backward Peak Amplitude Channel 2       1\nP2K    Backward Peak Location Channel 2        1\nDAQ    Data Acquisition Status                 0\nAG2    Actual Signal Gain Channel 2            1\nHUM    Relative Humidity Interferometer        14\nSSM    Sample Spacing Multiplier               1\nRSN    Running Sample Number                   565\nCRR    Correlation Rejection Reason            0\nSRT    Start Time (sec)                        1556890484.642\nDUR    Duration (sec)                          42.433990478515625\nTSC    Scanner Temperature                     27.8\nMVD    Max Velocity Deviation                  0.1158025860786438\nPRS    Pressure Interferometer (hPa)           1009.9999700000001\nAN1    Analog Signal 1                         0.22596596493037535\nAN2    Analog Signal 2                         3.459206583321489\nVSN    Firmware Version                        2.450 Oct 10 2014\nSRN    Instrument Serial Number                1135\nCAM    Coaddition Mode                         0\nINS    Instrument Type                         VERTEX 80V\nFOC    Focal Length                            100.0\nRDY    Ready Check                             1\n\n====================================================================================================\n                               Reference Instrument Status Parameters\nKey    Label                                   Value\nHFL    High Folding Limit                      15795.820598\nLFL    Low Folding Limit                       0.0\nLWN    Laser Wavenumber                        15795.820598\nABP    Absolute Peak Pos in Laser*2            52159\nSSP    Sample Spacing Divisor                  1\nARG    Actual Reference Gain                   1\nASG    Actual Signal Gain                      1\nASS    Number of Sample Scans                  1\nGFW    Number of Good Forward Scans            1\nGBW    Number of Good Backward Scans           0\nBFW    Number of Bad Forward Scans             0\nBBW    Number of Bad Backward Scans            0\nPKA    Peak Amplitude                          1644\nPKL    Peak Location                           7364\nPRA    Backward Peak Amplitude                 1\nPRL    Backward Peak Location                  -1\nP2A    Peak Amplitude Channel 2                1\nP2L    Peak Location Channel 2                 1\nP2R    Backward Peak Amplitude Channel 2       1\nP2K    Backward Peak Location Channel 2        1\nDAQ    Data Acquisition Status                 0\nAG2    Actual Signal Gain Channel 2            1\nHUM    Relative Humidity Interferometer        0\nSSM    Sample Spacing Multiplier               1\nRSN    Running Sample Number                   5816\nCRR    Correlation Rejection Reason            0\nSRT    Start Time (sec)                        1556890282.358\nDUR    Duration (sec)                          0.7919998168945312\nTSC    Scanner Temperature                     27.8\nMVD    Max Velocity Deviation                  0.10553144663572311\nPRS    Pressure Interferometer (hPa)           2.01999\nAN1    Analog Signal 1                         0.22577181458473206\nAN2    Analog Signal 2                         4.0960001945495605\nVSN    Firmware Version                        2.450 Oct 10 2014\nSRN    Instrument Serial Number                1135\nCAM    Coaddition Mode                         0\nINS    Instrument Type                         VERTEX 80V\nFOC    Focal Length                            100.0\nRDY    Ready Check                             1\nARS    Number of Reference Scans               1\n\n====================================================================================================\n                                    Reference Optical Parameters\nKey    Label                                   Value\nACC    Accessory                               TRANS *010A984F\nAPR    ATR Pressure                            0\nAPT    Aperture Setting                        1 mm\nBMS    Beamsplitter                            KBr-Broadband\nDTC    Detector                                RT-DLaTGS [Internal Pos.1]\nHPF    High Pass Filter                        0\nLPF    Low Pass Filter                         10.0\nLPV    Variable Low Pass Filter (cm-1)         4000\nOPF    Optical Filter Setting                  Open\nPGR    Reference Preamplifier Gain             3\nRCH    Reference Measurement Channel           Sample Compartment\nRDX    Extended Ready Check                    0\nSRC    Source                                  MIR\nVEL    Scanner Velocity                        10.0\nADC    External Analog Signals                 0\nSON    External Sync                           Off\n\n====================================================================================================\n                                  Reference Acquisition Parameters\nKey    Label                                   Value\nADT    Additional Data Treatment               0\nAQM    Acquisition Mode                        DD\nCFE    Low Intensity Power Mode with DTGS      0\nCOR    Correlation Test Mode                   0\nDEL    Delay Before Measurement                0\nDLY    Stabilization Delay                     0\nHFW    Wanted High Freq Limit                  15000.0\nLFW    Wanted Low Freq Limit                   0.0\nNSR    Number of Background Scans              1\nPLF    Result Spectrum Type                    TR\nRES    Resolution (cm-1)                       4.0\nRGN    Reference Signal Gain                   1\nSTR    Scans or Time (Reference)               0\nTCL    Command Line for Additional Data Tr...\nTDL    To Do List                              16777271\n\n====================================================================================================\n                               Reference Fourier Transform Parameters\nKey    Label                                   Value\nAPF    Apodization Function                    B3\nHFQ    End Frequency Limit for File            500.0\nLFQ    Start Frequency Limit for File          10000.0\nNLI    Nonlinearity Correction                 0\nPHR    Phase Resolution                        100.0\nPHZ    Phase Correction Mode                   ML\nSPZ    Stored Phase Mode                       NO\nZFF    Zero Filling Factor                     2\n
    \n
    \n\n

    \n\n

    \n\n

    You can access a specific parameter simply by calling the key as a direct attribute of the class (case insensitive). You\ncan also get the human-readable label using the get_param_label function:

    \n\n
    \n
    from brukeropus.file import get_param_label\ndata = read_opus('file.0')\nprint(get_param_label('bms') + ':', data.bms)\nprint(get_param_label('src') + ':', data.src)\n
    \n
    \n\n
    \n
    Beamsplitter: KBr-Broadband\nSource: MIR\n
    \n
    \n\n

    You will notice in the example output that some keys (e.g. zero filling factor zff) may have two entries: one for the\nsample measurement and another for the reference. By default, the sample parameters are accessible directly from the\nOPUSFile class, while the reference parameters can be accessed through the rf_params attribute.

    \n\n
    \n
    data = read_opus('file.0')\nprint('Sample ZFF:', data.zff, 'Reference ZFF:', data.rf_params.zff)\n
    \n
    \n\n
    \n
    Sample ZFF: 2 Reference ZFF: 2\n
    \n
    \n\n

    You can also iterate over the parameters using the familiar keys(), values(), and items() functions using the\nparams or rf_params attributes:

    \n\n
    \n
    data = read_opus('file.0')\nfor key, val in data.params.items():\n    print(key + ':', val)\n
    \n
    \n\n
    \n
    acc: TRANS *010A984F\napr: 0\napt: 1 mm\nbms: KBr-Broadband\nchn: Sample Compartment\ndtc: RT-DLaTGS [Internal Pos.1]\nhpf: 0\nlpf: 10.0\nlpv: 4000\nopf: Open\npgn: 3\n... continued ...\n
    \n
    \n\n

    Depending on the settings used to save the OPUS file, different data blocks can be stored. To retrieve a list of data\nblocks stored in the OPUS File, use the data_keys attribute:

    \n\n
    \n
    data = read_opus('file.0')\nprint(data.data_keys)\n
    \n
    \n\n
    \n
    ['igsm', 'phsm', 'sm', 'a', 'igrf', 'rf']\n
    \n
    \n\n

    Each key is also an attribute of the OPUSFile instance that returns either a Data or Data3D class. You can get\nthe x and y array values (in the units they were saved in) as direct attributes to the Data class:

    \n\n
    \n
    data = read_opus('file.0')\nplt.plot(data.a.x, data.a.y)\nplt.ylim((0, 1))\nplt.show()\n
    \n
    \n\n

    For spectra with wavenumber as valid unit (e.g. single-channel or ratioed spectra), the x array can be given in cm\u207b\u00b9\nor \u00b5m units by using the attributes wn or wl respectively:

    \n\n
    \n
    data = read_opus('file.0')\nplt.plot(data.sm.wl, data.sm.y)\nplt.show()\n
    \n
    \n\n

    You can also iterate over all data spectra in the file using the iter_data() method:

    \n\n
    \n
    data = read_opus('file.0')\nfor d in data.iter_data():\n    print(d.label, '(' + d.datetime.isoformat(' ') + ')')\n
    \n
    \n\n
    \n
    Sample Interferogram (2019-05-03 13:34:44.641000)\nSample Phase (2019-05-03 13:34:44.641000)\nSample Spectrum (2019-05-03 13:34:44.641000)\nAbsorbance (2019-05-03 13:34:44.641000)\nReference Interferogram (2019-05-03 13:31:22.358000)\nReference Spectrum (2019-05-03 13:31:22.358000)\n
    \n
    \n\n

    Each data block in an OPUS file also contains a small parameter block with information such as the min/max y-value\n(mny, mxy), x-units (dxu), number of data points (npt), etc. These can be accessed as direct attributes to the Data\nclass, or through the params attribute:

    \n\n
    \n
    data = read_opus('file.0')\nprint('Sample spectra y-min:', data.sm.mny, 'y-max:', data.sm.mxy)\n
    \n
    \n\n
    \n
    Sample spectra y-min: 1.2147593224653974e-05 y-max: 0.03543896973133087\n
    \n
    \n\n

    For full API documentation, see:
    \nOPUSFile: brukeropus.file.file.OPUSFile
    \nData: brukeropus.file.file.Data
    \nData3D: brukeropus.file.file.Data3D

    \n"}, {"fullname": "brukeropus.file.constants", "modulename": "brukeropus.file.constants", "kind": "module", "doc": "

    \n"}, {"fullname": "brukeropus.file.constants.PARAM_LABELS", "modulename": "brukeropus.file.constants", "qualname": "PARAM_LABELS", "kind": "variable", "doc": "

    \n", "default_value": "{'ACC': 'Accessory', 'ABP': 'Absolute Peak Pos in Laser*2', 'ADC': 'External Analog Signals', 'ADT': 'Additional Data Treatment', 'AG2': 'Actual Signal Gain Channel 2', 'AN1': 'Analog Signal 1', 'AN2': 'Analog Signal 2', 'APF': 'Apodization Function', 'APR': 'ATR Pressure', 'APT': 'Aperture Setting', 'AQM': 'Acquisition Mode', 'ARG': 'Actual Reference Gain', 'ARS': 'Number of Reference Scans', 'ASG': 'Actual Signal Gain', 'ASS': 'Number of Sample Scans', 'BBW': 'Number of Bad Backward Scans', 'BFW': 'Number of Bad Forward Scans', 'BLD': 'Building', 'BMS': 'Beamsplitter', 'CAM': 'Coaddition Mode', 'CFE': 'Low Intensity Power Mode with DTGS', 'CHN': 'Measurement Channel', 'CNM': 'Operator Name', 'COR': 'Correlation Test Mode', 'CPG': 'Character Encoding Code Page', 'CPY': 'Company', 'CRR': 'Correlation Rejection Reason', 'CSF': 'Y Scaling Factor', 'DAQ': 'Data Acquisition Status', 'DAT': 'Date of Measurement', 'DEL': 'Delay Before Measurement', 'DLY': 'Stabilization Delay', 'DPF': 'Data Point Format', 'DPM': 'Department', 'DTC': 'Detector', 'DUR': 'Duration (sec)', 'DXU': 'X Units', 'DYU': 'Y Units', 'EXP': 'Experiment', 'FOC': 'Focal Length', 'FXV': 'First X Value', 'GBW': 'Number of Good Backward Scans', 'GFW': 'Number of Good Forward Scans', 'HFF': 'Digital Filter High Folding Limit', 'HFL': 'High Folding Limit', 'HFQ': 'End Frequency Limit for File', 'HFW': 'Wanted High Freq Limit', 'HPF': 'High Pass Filter', 'HUM': 'Relative Humidity Interferometer', 'INS': 'Instrument Type', 'IST': 'Instrument Status', 'LCT': 'Location', 'LFF': 'Digital Filter Low Folding Limit', 'LFL': 'Low Folding Limit', 'LFQ': 'Start Frequency Limit for File', 'LFW': 'Wanted Low Freq Limit', 'LPF': 'Low Pass Filter', 'LPV': 'Variable Low Pass Filter (cm-1)', 'LWN': 'Laser Wavenumber', 'LXV': 'Last X Value', 'MNY': 'Y Minimum', 'MVD': 'Max Velocity Deviation', 'MXY': 'Y Maximum', 'NFL': 'Nominal FW Peak Pos in Points', 'NLA': 'NL Alpha', 'NLB': 'NL Beta', 'NLI': 'Nonlinearity Correction', 'NPT': 'Number of Data Points', 'NSN': 'Scan Number', 'NSR': 'Number of Background Scans', 'NSS': 'Number of Sample Scans', 'OPF': 'Optical Filter Setting', 'P2A': 'Peak Amplitude Channel 2', 'P2K': 'Backward Peak Location Channel 2', 'P2L': 'Peak Location Channel 2', 'P2R': 'Backward Peak Amplitude Channel 2', 'PGN': 'Preamplifier Gain', 'PGR': 'Reference Preamplifier Gain', 'PHR': 'Phase Resolution', 'PHZ': 'Phase Correction Mode', 'PKA': 'Peak Amplitude', 'PKL': 'Peak Location', 'PLF': 'Result Spectrum Type', 'PRA': 'Backward Peak Amplitude', 'PRL': 'Backward Peak Location', 'PRS': 'Pressure Interferometer (hPa)', 'RCH': 'Reference Measurement Channel', 'RDX': 'Extended Ready Check', 'RDY': 'Ready Check', 'RES': 'Resolution (cm-1)', 'RG2': 'Signal Gain, Background 2nd Channel', 'RGN': 'Reference Signal Gain', 'RSN': 'Running Sample Number', 'SFM': 'Sample Form', 'SG2': 'Signal Gain, Sample 2nd Channel', 'SGN': 'Sample Signal Gain', 'SNM': 'Sample Name', 'SON': 'External Sync', 'SOT': 'Sample Scans or Time', 'SPO': 'Sample Number', 'SPZ': 'Stored Phase Mode', 'SRC': 'Source', 'SRN': 'Instrument Serial Number', 'SRT': 'Start Time (sec)', 'SSM': 'Sample Spacing Multiplier', 'SSP': 'Sample Spacing Divisor', 'STR': 'Scans or Time (Reference)', 'TCL': 'Command Line for Additional Data Treatment', 'TDL': 'To Do List', 'TIM': 'Time of Measurement', 'TPX': 'Total Points X', 'TSC': 'Scanner Temperature', 'UID': 'Universally Unique Identifier', 'VEL': 'Scanner Velocity', 'VSN': 'Firmware Version', 'WAS': 'Tr.Rec. Slices', 'WDV': 'Transient Recorder', 'WIB': 'Tr.Rec.Input Range 2nd channel', 'WIR': 'Tr.Rec.Input Range', 'WPD': 'Tr.Rec. Stab. Delay after Stepping', 'WRC': 'Tr.Rec. Repeat Count', 'WSS': 'Tr.Rec. Sampling Source', 'WTD': 'Tr.Rec. trigger Delay in points', 'WTR': 'Tr.Rec. Resolution', 'WXD': 'Tr.Rec. Experiment Delay', 'WXP': 'Tr.Rec. Trigger Mode', 'XPP': 'Experiment Path', 'XSM': 'Xs Sampling Mode', 'ZFF': 'Zero Filling Factor'}"}, {"fullname": "brukeropus.file.constants.CODE_0", "modulename": "brukeropus.file.constants", "qualname": "CODE_0", "kind": "variable", "doc": "

    \n", "default_value": "{0: '', 1: 'Real Part of Complex Data', 2: 'Imaginary Part of Complex Data', 3: ''}"}, {"fullname": "brukeropus.file.constants.CODE_1", "modulename": "brukeropus.file.constants", "qualname": "CODE_1", "kind": "variable", "doc": "

    \n", "default_value": "{0: '', 1: 'Sample', 2: 'Reference', 3: ''}"}, {"fullname": "brukeropus.file.constants.CODE_2", "modulename": "brukeropus.file.constants", "qualname": "CODE_2", "kind": "variable", "doc": "

    \n", "default_value": "{0: '', 1: 'Data Status Parameters', 2: 'Instrument Status Parameters', 3: 'Acquisition Parameters', 4: 'Fourier Transform Parameters', 5: 'Plot and Display Parameters', 6: 'Optical Parameters', 7: 'GC Parameters', 8: 'Library Search Parameters', 9: 'Communication Parameters', 10: 'Sample Origin Parameters'}"}, {"fullname": "brukeropus.file.constants.CODE_3", "modulename": "brukeropus.file.constants", "qualname": "CODE_3", "kind": "variable", "doc": "

    \n", "default_value": "{0: '', 1: 'Spectrum', 2: 'Interferogram', 3: 'Phase', 4: 'Absorbance', 5: 'Transmittance', 6: 'Kubelka-Munk', 7: 'Trace (Intensity over time)', 8: 'gc File, Series of Interferograms', 9: 'gc File, Series of Spectra', 10: 'Raman', 11: 'Emisson', 12: 'Reflectance', 13: 'Directory', 14: 'Power', 15: 'log Reflectance', 16: 'ATR', 17: 'Photoacoustic', 18: 'Result of Arithmatics, looks like Transmittance', 19: 'Result of Arithmatics, looks like Absorbance'}"}, {"fullname": "brukeropus.file.constants.CODE_4", "modulename": "brukeropus.file.constants", "qualname": "CODE_4", "kind": "variable", "doc": "

    \n", "default_value": "{0: '', 1: 'First Derivative', 2: 'Second Derivative', 3: 'n-th Derivative'}"}, {"fullname": "brukeropus.file.constants.CODE_5", "modulename": "brukeropus.file.constants", "qualname": "CODE_5", "kind": "variable", "doc": "

    \n", "default_value": "{0: '', 1: 'Compound Information', 2: 'Peak Table', 3: 'Molecular Structure', 4: 'Macro', 5: 'File Log'}"}, {"fullname": "brukeropus.file.constants.CODE_3_ABR", "modulename": "brukeropus.file.constants", "qualname": "CODE_3_ABR", "kind": "variable", "doc": "

    \n", "default_value": "{0: '', 1: '', 2: 'ig', 3: 'ph', 4: 'a', 5: 't', 6: 'km', 7: 'tr', 8: 'gcig', 9: 'gcsc', 10: 'ra', 11: 'e', 12: 'r', 13: 'dir', 14: 'p', 15: 'logr', 16: 'atr', 17: 'pas', 18: 'arit', 19: 'aria'}"}, {"fullname": "brukeropus.file.constants.TYPE_CODE_LABELS", "modulename": "brukeropus.file.constants", "qualname": "TYPE_CODE_LABELS", "kind": "variable", "doc": "

    \n", "default_value": "[{0: '', 1: 'Real Part of Complex Data', 2: 'Imaginary Part of Complex Data', 3: ''}, {0: '', 1: 'Sample', 2: 'Reference', 3: ''}, {0: '', 1: 'Data Status Parameters', 2: 'Instrument Status Parameters', 3: 'Acquisition Parameters', 4: 'Fourier Transform Parameters', 5: 'Plot and Display Parameters', 6: 'Optical Parameters', 7: 'GC Parameters', 8: 'Library Search Parameters', 9: 'Communication Parameters', 10: 'Sample Origin Parameters'}, {0: '', 1: 'Spectrum', 2: 'Interferogram', 3: 'Phase', 4: 'Absorbance', 5: 'Transmittance', 6: 'Kubelka-Munk', 7: 'Trace (Intensity over time)', 8: 'gc File, Series of Interferograms', 9: 'gc File, Series of Spectra', 10: 'Raman', 11: 'Emisson', 12: 'Reflectance', 13: 'Directory', 14: 'Power', 15: 'log Reflectance', 16: 'ATR', 17: 'Photoacoustic', 18: 'Result of Arithmatics, looks like Transmittance', 19: 'Result of Arithmatics, looks like Absorbance'}, {0: '', 1: 'First Derivative', 2: 'Second Derivative', 3: 'n-th Derivative'}, {0: '', 1: 'Compound Information', 2: 'Peak Table', 3: 'Molecular Structure', 4: 'Macro', 5: 'File Log'}]"}, {"fullname": "brukeropus.file.constants.STRUCT_3D_INFO_BLOCK", "modulename": "brukeropus.file.constants", "qualname": "STRUCT_3D_INFO_BLOCK", "kind": "variable", "doc": "

    \n", "default_value": "[{'key': 'nss', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'nsr', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'nsn', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'npt', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'gfw', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'gbw', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'bfw', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'bbw', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'hfl', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'lfl', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'hff', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'lff', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'filter_size', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'filter_type', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'fxv', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'lxv', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'mny', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'mxy', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'csf', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'pka', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'pra', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'pkl', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'prl', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'srt', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'tim', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}]"}, {"fullname": "brukeropus.file.constants.Y_LABELS", "modulename": "brukeropus.file.constants", "qualname": "Y_LABELS", "kind": "variable", "doc": "

    \n", "default_value": "{'sm': 'Sample Spectrum', 'rf': 'Reference Spectrum', 'igsm': 'Sample Interferogram', 'igrf': 'Reference Interferogram', 'phsm': 'Sample Phase', 'phrf': 'Reference Phase', 'a': 'Absorbance', 't': 'Transmittance', 'r': 'Reflectance', 'km': 'Kubelka-Munk', 'tr': 'Trace (Intensity over Time)', 'gcig': 'gc File (Series of Interferograms)', 'gcsc': 'gc File (Series of Spectra)', 'ra': 'Raman', 'e': 'Emission', 'dir': 'Directory', 'p': 'Power', 'logr': 'log(Reflectance)', 'atr': 'ATR', 'pas': 'Photoacoustic'}"}, {"fullname": "brukeropus.file.constants.XUN_LABELS", "modulename": "brukeropus.file.constants", "qualname": "XUN_LABELS", "kind": "variable", "doc": "

    \n", "default_value": "{'wl': 'Wavelength', 'wn': 'Wavenumber', 'f': 'Frequency', 'pnt': 'Points', 'min': 'Minutes', 'logwn': 'Log Wavenumber'}"}, {"fullname": "brukeropus.file.file", "modulename": "brukeropus.file.file", "kind": "module", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.read_opus", "modulename": "brukeropus.file.file", "qualname": "read_opus", "kind": "function", "doc": "

    Return an OPUSFile object from an OPUS file filepath.

    \n\n
    The following produces identical results:
    \n\n
    \n
    \n
    data = read_opus(filepath)\ndata = OPUSFile(filepath)\n
    \n
    \n
    \n\n
    Arguments:
    \n\n
      \n
    • filepath (str or Path): filepath of an OPUS file (typically *.0)
    • \n
    \n\n
    Returns:
    \n\n
    \n

    opus_file (OPUSFile): an instance of the OPUSFile class containing all data/metadata extracted from the\n file.

    \n
    \n", "signature": "(filepath):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.OPUSFile", "modulename": "brukeropus.file.file", "qualname": "OPUSFile", "kind": "class", "doc": "

    Class that contains the data and metadata contained in a bruker OPUS file.

    \n\n
    Arguments:
    \n\n
      \n
    • filepath: full path to the OPUS file to be parsed. Can be a string or Path object and is required to initilize\nan OPUSFile object.
    • \n
    \n\n
    Attributes:
    \n\n
      \n
    • is_opus (bool): True if filepath points to an OPUS file, False otherwise. Also returned for dunder \n__bool__()
    • \n
    • params (Parameters): class containing all general parameter metadata for the OPUS file. To save typing, the\nthree char parameters from params also become attributes of the OPUSFile class (e.g. bms, apt, src)
    • \n
    • rf_params (Parameters): class containing all reference parameter metadata for the OPUS file.
    • \n
    • data_keys (list): list of all data block keys stored in the file (i.e. sm, rf, t, a, r, igsm, igrf, phsm, etc.).\nThese keys become data attributes of the class which return an instance of Data or Data3D.
    • \n
    • datetime (datetime): Returns the most recent datetime of all the data blocks stored in the file (typically\nresult spectra)
    • \n
    • directory (FileDirectory): class containing information about all the various data blocks in the file.
    • \n
    • file_log (str): File log containing text about how the file was generated/edited (not always saved)
    • \n
    \n\n
    Data Attributes:
    \n\n
    \n

    sm: Single-channel sample spectra
    \n rf: Single-channel reference spectra
    \n igsm: Sample interferogram
    \n igrf: Reference interferogram
    \n phsm: Sample phase
    \n phrf: Reference phase
    \n a: Absorbance
    \n t: Transmittance
    \n r: Reflectance
    \n km: Kubelka-Munk
    \n tr: Trace (Intensity over Time)
    \n gcig: gc File (Series of Interferograms)
    \n gcsc: gc File (Series of Spectra)
    \n ra: Raman
    \n e: Emission
    \n dir: Directory
    \n p: Power
    \n logr: log(Reflectance)
    \n atr: ATR
    \n pas: Photoacoustic

    \n
    \n"}, {"fullname": "brukeropus.file.file.OPUSFile.__init__", "modulename": "brukeropus.file.file", "qualname": "OPUSFile.__init__", "kind": "function", "doc": "

    \n", "signature": "(filepath: str)"}, {"fullname": "brukeropus.file.file.OPUSFile.filepath", "modulename": "brukeropus.file.file", "qualname": "OPUSFile.filepath", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.OPUSFile.print_parameters", "modulename": "brukeropus.file.file", "qualname": "OPUSFile.print_parameters", "kind": "function", "doc": "

    Prints all the parameter metadata to the console (organized by block)

    \n", "signature": "(self, key_width=7, label_width=40, value_width=53):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.OPUSFile.iter_data", "modulename": "brukeropus.file.file", "qualname": "OPUSFile.iter_data", "kind": "function", "doc": "

    Generator that yields the various Data classes from the OPUSFile

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo", "kind": "class", "doc": "

    Contains type, size and location information about an OPUS file block.

    \n\n

    This information is parsed from the directory block of an OPUS file and provides the information needed to parse the\nblock.

    \n\n
    Arguments:
    \n\n
      \n
    • block_type: six integer tuple that describes the type of data in the file block
    • \n
    • size: size of block in number of bytes
    • \n
    • start: pointer to start location of the block within the file.
    • \n
    \n\n
    Attributes:
    \n\n
      \n
    • type: six integer tuple that describes the type of data in the file block
    • \n
    • size: size of block in number of bytes
    • \n
    • start: pointer to start location of the block within the file
    • \n
    • keys: tuple of three char keys contained in parameter blocks. This attribute is set by the OPUSFile class only\nwhen the block is parameter block. This enables grouping parameters by block if desired.
    • \n
    \n"}, {"fullname": "brukeropus.file.file.FileBlockInfo.__init__", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.__init__", "kind": "function", "doc": "

    \n", "signature": "(block_type: tuple, size: int, start: int)"}, {"fullname": "brukeropus.file.file.FileBlockInfo.keys", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.keys", "kind": "variable", "doc": "

    \n", "annotation": ": tuple"}, {"fullname": "brukeropus.file.file.FileBlockInfo.type", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.type", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.FileBlockInfo.size", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.size", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.FileBlockInfo.start", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.start", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_valid", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_valid", "kind": "function", "doc": "

    Returns False if FileBlockInfo is undefined (i.e. FileBlockInfo.type == (0, 0, 0, 0, 0, 0))

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_data_status", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_data_status", "kind": "function", "doc": "

    Returns True if FileBlockInfo is a data status parameter block

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_rf_param", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_rf_param", "kind": "function", "doc": "

    Returns True if FileBlockInfo is a parameter block associated with the reference measurement

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_param", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_param", "kind": "function", "doc": "

    Returns True if FileBlockInfo is a parameter block

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_directory", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_directory", "kind": "function", "doc": "

    Returns True if FileBlockInfo is the directory block

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_file_log", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_file_log", "kind": "function", "doc": "

    Returns True if FileBlockInfo is the file log block

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_data", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_data", "kind": "function", "doc": "

    Returns True if FileBlockInfo is a data block or 3D data block

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_3d_data", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_3d_data", "kind": "function", "doc": "

    Returns True if FileBlockInfo is a 3D data block (i.e. data series)

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_data_status_match", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_data_status_match", "kind": "function", "doc": "

    Returns True if FileBlockInfo is a data status block and a match to the data_block_info argument.

    \n\n

    This function is used to match a data status block (contains metadata for data block) with its associated data\nblock (contains array data).

    \n\n
    Arguments:
    \n\n
      \n
    • data_block_info (FileBlockInfo): data block being tested as a match.
    • \n
    \n\n
    Returns:
    \n\n
    \n

    is_match (bool): True if FileBlockInfo is data status block and input argument is matching data block

    \n
    \n", "signature": "(self, data_block_info):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.get_label", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.get_label", "kind": "function", "doc": "

    Returns a friendly string label that describes the block type

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.get_data_key", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.get_data_key", "kind": "function", "doc": "

    If block is a data block, this function will return an shorthand key to reference that data.

    \n\n

    e.g. t: transmission, a: absorption, sm: sample, rf: reference, smph: sample phase etc. If the block is not\na data block, it will return None.

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.Data", "modulename": "brukeropus.file.file", "qualname": "Data", "kind": "class", "doc": "

    Class containing array data and associated parameter/metadata from an OPUS file.

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: raw bytes from OPUS file. see: read_opus_file_bytes
    • \n
    • data_info: FileBlockInfo instance of a data block
    • \n
    • data_status_info: FileBlockInfo instance of a data status block which contains metadata about the data_info\nblock. This block is a parameter block.
    • \n
    \n\n
    Attributes:
    \n\n
      \n
    • params: Parameter class with metadata associated with the data block such as first x point: fxp, last x\npoint: lxp, number of points: npt, date: dat, time: tim etc.
    • \n
    • y: 1D numpy array containing y values of data block
    • \n
    • x: 1D numpy array containing x values of data block. Units of x array are given by dxu parameter.
    • \n
    • label: human-readable string label describing the data block (e.g. Sample Spectrum, Absorbance, etc.)
    • \n
    \n\n
    Extended Attributes:
    \n\n
    \n

    wn: Returns the x array in wavenumber (cm\u207b\u00b9) units regardless of what units the x array was originally\n saved in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not\n interferogram or phase blocks.
    \n wl: Returns the x array in wavelength (\u00b5m) units regardless of what units the x array was originally\n saved in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not\n interferogram or phase blocks.
    \n f: Returns the x array in modulation frequency units (Hz) regardless of what units the x array was\n originally saved in. This is only valid for spectral data blocks such as sample, reference, transmission,\n etc., not interferogram or phase blocks.
    \n datetime: Returns a datetime class of when the data was taken (extracted from data status parameter block).
    \n xxx: the various three char parameter keys from the params attribute can be directly called from the \n Data class for convenience. Common parameters include dxu (x units), mxy (max y value), mny (min y\n value), etc.

    \n
    \n"}, {"fullname": "brukeropus.file.file.Data.__init__", "modulename": "brukeropus.file.file", "qualname": "Data.__init__", "kind": "function", "doc": "

    \n", "signature": "(\tfilebytes: bytes,\tdata_info: brukeropus.file.file.FileBlockInfo,\tdata_status_info: brukeropus.file.file.FileBlockInfo)"}, {"fullname": "brukeropus.file.file.Data.params", "modulename": "brukeropus.file.file", "qualname": "Data.params", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data.y", "modulename": "brukeropus.file.file", "qualname": "Data.y", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data.x", "modulename": "brukeropus.file.file", "qualname": "Data.x", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data.label", "modulename": "brukeropus.file.file", "qualname": "Data.label", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data.vel", "modulename": "brukeropus.file.file", "qualname": "Data.vel", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data3D", "modulename": "brukeropus.file.file", "qualname": "Data3D", "kind": "class", "doc": "

    Class containing 3D array data (series of spectra) and associated parameter/metadata from an OPUS file.

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: raw bytes from OPUS file. see: read_opus_file_bytes
    • \n
    • data_info: FileBlockInfo instance of a 3D data block
    • \n
    • data_status_info: FileBlockInfo instance of a data status block which contains metadata about the data_info\nblock. This block is a parameter block.
    • \n
    \n\n
    Attributes:
    \n\n
      \n
    • params: Parameter class with metadata associated with the data block such as first x point (fxp), last x point\n(lxp), number of points (npt), date (dat), time (tim) etc.
    • \n
    • y: 2D numpy array containing y values of data block
    • \n
    • x: 1D numpy array containing x values of data block. Units of x array are given by .dxu attribute.
    • \n
    • num_spectra: number of spectra in the series (i.e. length of y)
    • \n
    • label: human-readable string label describing the data block (e.g. Sample Spectrum, Absorbance, etc.)
    • \n
    \n\n
    Extended Attributes:
    \n\n
    \n

    wn: Returns the x array in wavenumber (cm\u207b\u00b9) units regardless of what units the x array was originally saved\n in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not\n interferogram or phase blocks.
    \n wl: Returns the x array in wavelength (\u00b5m) units regardless of what units the x array was originally saved\n in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not\n interferogram or phase blocks.
    \n datetime: Returns a datetime class of when the data was taken (extracted from data status parameter\n block).
    \n xxx: the various three char parameter keys from the \"params\" attribute can be directly called from the data\n class for convenience. Several of these parameters return arrays, rather than singular values because they\n are recorded for every spectra in the series, e.g. npt, mny, mxy, tim, nsn.

    \n
    \n", "bases": "Data"}, {"fullname": "brukeropus.file.file.Data3D.__init__", "modulename": "brukeropus.file.file", "qualname": "Data3D.__init__", "kind": "function", "doc": "

    \n", "signature": "(\tfilebytes: bytes,\tdata_info: brukeropus.file.file.FileBlockInfo,\tdata_status_info: brukeropus.file.file.FileBlockInfo)"}, {"fullname": "brukeropus.file.file.Data3D.params", "modulename": "brukeropus.file.file", "qualname": "Data3D.params", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data3D.y", "modulename": "brukeropus.file.file", "qualname": "Data3D.y", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data3D.x", "modulename": "brukeropus.file.file", "qualname": "Data3D.x", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data3D.num_spectra", "modulename": "brukeropus.file.file", "qualname": "Data3D.num_spectra", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data3D.label", "modulename": "brukeropus.file.file", "qualname": "Data3D.label", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Parameters", "modulename": "brukeropus.file.file", "qualname": "Parameters", "kind": "class", "doc": "

    Class containing parameter metadata of an OPUS file.

    \n\n

    Parameters of an OPUS file are stored as key, val pairs, where the key is always three chars. For example, the\nbeamsplitter is stored in the \"bms\" attribute, source in \"src\" etc. A list of known keys, with friendly label can\nbe found in brukeropus.file.constants.PARAM_LABELS. The keys in an OPUS file are not case sensitive, and stored\nin all CAPS (i.e. BMS, SRC, etc.) but this class uses lower case keys to follow python convention. The class is\ninitialized from a list of parameter FileBlockInfo. The key, val items in blocks of the list are combined into\none parameter class, so care must be taken not to pass blocks that will overwrite each others keys. Analagous to a\ndict, the keys, values, and (key, val) can be iterated over using the functions: keys(), values(), and items()\nrespectively.

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: raw bytes from OPUS file. see: brukeropus.file.parser.read_opus_file_bytes
    • \n
    • param_blocks: list of FileBlockInfo; every block in the list should be classified as a parameter block.
    • \n
    \n\n
    Attributes:
    \n\n
      \n
    • xxx: parameter attributes are stored as three char keys. Which keys are generated depends on the list of\nFileBlockInfo that is used to initialize the class. If input list contains a single data status\nFileBlockInfo, attributes will include: fxv, lxv, npt (first x-val, last x-val, number of points),\netc. Other blocks produce attributes such as: bms, src, apt (beamsplitter, source, aperture) etc. A\nfull list of keys available in a given Parameters instance are given by the keys() method.
    • \n
    • datetime: if blocks contain the keys: dat (date) and tim (time), the datetime attribute of this class will\nbe set to a python datetime object. Currently, only data status blocks are known to have these keys. If\ndat and tim are not present in the class, the datetime attribute will return None.
    • \n
    \n"}, {"fullname": "brukeropus.file.file.Parameters.__init__", "modulename": "brukeropus.file.file", "qualname": "Parameters.__init__", "kind": "function", "doc": "

    \n", "signature": "(filebytes: bytes, param_blocks: list)"}, {"fullname": "brukeropus.file.file.Parameters.keys", "modulename": "brukeropus.file.file", "qualname": "Parameters.keys", "kind": "function", "doc": "

    Returns a dict_keys class of all valid keys in the class (i.e. dict.keys())

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.Parameters.values", "modulename": "brukeropus.file.file", "qualname": "Parameters.values", "kind": "function", "doc": "

    Returns a dict_values class of all the values in the class (i.e. dict.values())

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.Parameters.items", "modulename": "brukeropus.file.file", "qualname": "Parameters.items", "kind": "function", "doc": "

    Returns a dict_items class of all the values in the class (i.e. dict.items())

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.Parameters.datetime", "modulename": "brukeropus.file.file", "qualname": "Parameters.datetime", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.FileDirectory", "modulename": "brukeropus.file.file", "qualname": "FileDirectory", "kind": "class", "doc": "

    Contains type and pointer information for all blocks of data in an OPUS file.

    \n\n

    FileDirectory information is decoded from the raw file bytes of an OPUS file. First the header is read which\nprovides the start location of the directory block, number of blocks in file, and maximum number of blocks the file\nsupports. Then it decodes the block pointer information from each entry of the file's directory block. Rather than\nstore all file blocks in a single list (as it is done in the OPUS file directory), this class sorts the blocks into\ncategories: data, data_status, params, rf_params, directory, and file_log. It also pairs the data\nblocks with their corresponding data_status block to simplify grouping y data with the parameters that are used to\ngenerate x data and other data block specific metadata.

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: raw bytes from OPUS file. see: brukeropus.file.parser.read_opus_file_bytes
    • \n
    \n\n
    Attributes:
    \n\n
      \n
    • start: pointer to start location of the directory block
    • \n
    • max_blocks: maximum number of blocks supported by file
    • \n
    • num_blocks: total number of blocks in the file
    • \n
    • data_blocks: list of FileBlockInfo that contain array data (e.g. sample, reference, phase)
    • \n
    • data_status_blocks: list of FileBlockInfo that contain metadata specific to a data block (units, etc.)
    • \n
    • param_blocks: list of FileBlockInfo that contain metadata about the measurement sample
    • \n
    • rf_param_blocks: list of FileBlockInfo that contain metatdata about the reference measurement
    • \n
    • directory_block: FileBlockInfo for directory block that contains all the block info in the file
    • \n
    • file_log_block: FileBlockInfo of the file log (changes, etc.)
    • \n
    • data_and_status_block_pairs: (data: FileBlockInfo, data_status: FileBlockInfo) which pairs the data status\nparameter block (time, x units, y units, etc.) with the data block it informs
    • \n
    \n"}, {"fullname": "brukeropus.file.file.FileDirectory.__init__", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.__init__", "kind": "function", "doc": "

    \n", "signature": "(filebytes: bytes)"}, {"fullname": "brukeropus.file.file.FileDirectory.data_blocks", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.data_blocks", "kind": "variable", "doc": "

    \n", "annotation": ": list"}, {"fullname": "brukeropus.file.file.FileDirectory.data_status_blocks", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.data_status_blocks", "kind": "variable", "doc": "

    \n", "annotation": ": list"}, {"fullname": "brukeropus.file.file.FileDirectory.param_blocks", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.param_blocks", "kind": "variable", "doc": "

    \n", "annotation": ": list"}, {"fullname": "brukeropus.file.file.FileDirectory.rf_param_blocks", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.rf_param_blocks", "kind": "variable", "doc": "

    \n", "annotation": ": list"}, {"fullname": "brukeropus.file.file.FileDirectory.directory_block", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.directory_block", "kind": "variable", "doc": "

    \n", "annotation": ": brukeropus.file.file.FileBlockInfo"}, {"fullname": "brukeropus.file.file.FileDirectory.file_log_block", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.file_log_block", "kind": "variable", "doc": "

    \n", "annotation": ": brukeropus.file.file.FileBlockInfo"}, {"fullname": "brukeropus.file.file.FileDirectory.data_and_status_block_pairs", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.data_and_status_block_pairs", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.FileDirectory.max_blocks", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.max_blocks", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.FileDirectory.num_blocks", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.num_blocks", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.FileDirectory.start", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.start", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.FileDirectory.version", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.version", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.parser", "modulename": "brukeropus.file.parser", "kind": "module", "doc": "

    \n"}, {"fullname": "brukeropus.file.parser.read_opus_file_bytes", "modulename": "brukeropus.file.parser", "qualname": "read_opus_file_bytes", "kind": "function", "doc": "

    Returns bytes of an OPUS file specified by filepath (or None).

    \n\n

    Function determines if filepath points to an OPUS file by reading the first four bytes which are always the same\nfor OPUS files. If filepath is not a file, or points to a non-OPUS file, the function returns None. Otherwise\nthe function returns the entire file as raw bytes.

    \n\n
    Arguments:
    \n\n
      \n
    • filepath (str or Path): full filepath to OPUS file
    • \n
    \n\n
    Returns:
    \n\n
    \n

    filebytes (bytes): raw bytes of OPUS file or None (if filepath does not point to an OPUS file)

    \n
    \n", "signature": "(filepath):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.get_block_type", "modulename": "brukeropus.file.parser", "qualname": "get_block_type", "kind": "function", "doc": "

    Converts an int32 block type code to a six-integer tuple block_type.

    \n\n

    This function is used to decode the type_int from the directory block of an OPUS file into a tuple of integers.\nEach integer in the tuple provides information about the associated data block.

    \n\n
    Arguments:
    \n\n
      \n
    • type_int: 32-bit integer decoded from file directory block
    • \n
    \n\n
    Returns:
    \n\n
    \n

    block_type (tuple): six-integer tuple which specifies the block type

    \n
    \n", "signature": "(type_int: int):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.parse_header", "modulename": "brukeropus.file.parser", "qualname": "parse_header", "kind": "function", "doc": "

    Parses the OPUS file header.

    \n\n

    The header of an OPUS file contains some basic information about the file including the version number, location of\nthe directory block, and number of blocks in the file. This header is first to be parsed as it specifies how to\nread the file directory block (which contains information about each block in the file)

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: raw bytes of OPUS file (all bytes)
    • \n
    \n\n
    Returns:
    \n\n
    \n

    header_info (tuple):
    \n (
    \n version (float64): program version number as a floating-point date (later versions always greater)
    \n directory_start (int32): pointer to start location of directory block (number of bytes)
    \n max_blocks (int32): maximum number of blocks supported by the directory block (this should only be\n relevant when trying to edit an OPUS file, i.e. when adding data blocks to a file)
    \n num_blocks (int32): total number of blocks in the opus file
    \n )

    \n
    \n", "signature": "(filebytes: bytes):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.parse_directory", "modulename": "brukeropus.file.parser", "qualname": "parse_directory", "kind": "function", "doc": "

    Parses directory block of OPUS file and yields block info for all blocks in the file as a generator.

    \n\n

    The directory block of an OPUS file contains information about every block in the file. The block information is\nstored as three int32 values: type_int, size_int, start. type_int is an integer representation of the block\ntype. The bits of this type_int have meaning and are parsed into a tuple using get_block_type. The size_int is\nthe size of the block in 32-bit words. start is the starting location of the block (in number of bytes).

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: raw bytes of OPUS file (all bytes)
    • \n
    • start: start location of the directory block (specified in file header)
    • \n
    • num_blocks: total number of blocks in the file (specified in file header)
    • \n
    \n\n
    Yields:
    \n\n
    \n

    block_info (tuple):
    \n (
    \n block_type (tuple): six-integer tuple which specifies the block type (see: get_block_type)
    \n size (int): size (number of bytes) of the block
    \n start (int): pointer to start location of the block (number of bytes)
    \n )

    \n
    \n", "signature": "(filebytes: bytes, directory_start: int, num_blocks: int):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.parse_param_block", "modulename": "brukeropus.file.parser", "qualname": "parse_param_block", "kind": "function", "doc": "

    Parses the bytes in a parameter block and yields the key, value pairs as a generator.

    \n\n

    Parameter blocks are in the form: XXX, dtype_code, size, val. XXX is a three char abbreviation of the\nparameter (key). The value of the parameter is decoded according to the dtype_code and size integers to be either:\nint, float, or string.

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: raw bytes of OPUS file (all bytes)
    • \n
    • size: total number of bytes in parameter block (specified in file directory)
    • \n
    • start: pointer to start location of parameter block (specified in file directory)
    • \n
    \n\n
    Yields:
    \n\n
    \n

    items (tuple): (key, value) pairs where key is three char string (lowercase) and value can be int, float\n or string.

    \n
    \n", "signature": "(filebytes: bytes, size: int, start: int):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.get_dpf_dtype_count", "modulename": "brukeropus.file.parser", "qualname": "get_dpf_dtype_count", "kind": "function", "doc": "

    Returns numpy dtype and array count from the data point format (dpf) and block size (in bytes).

    \n\n
    Arguments:
    \n\n
      \n
    • dpf: data point format integer stored in data status block.\ndpf = 1 -> array of float32\ndpf = 2 -> array of int32
    • \n
    • size: Block size in bytes.
    • \n
    \n\n
    Returns:
    \n\n
    \n

    dtype (numpy.dtype): numpy dtype for defining an ndarray to store the data\n count (int): length of array calculated from the block size and byte size of the dtype.

    \n
    \n", "signature": "(dpf: int, size: int):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.parse_data_block", "modulename": "brukeropus.file.parser", "qualname": "parse_data_block", "kind": "function", "doc": "

    Parses the bytes in a data block (specified by size and start pointers) and returns a numpy array.

    \n\n

    Data blocks contain no metadata, only the y-values of a data array. Data arrays include: single-channel sample,\nreference, phase, interferograms, and a variety of resultant data (transmission, absorption, etc.). Every data\nblock should have a corresponding data status parameter block which can be used to generate the x-array values for\nthe data block. The data status block also specifies the data type of the data array with the DPF parameter. It\nappears that OPUS currently exclusively stores data blocks as 32-bit floats, but has a reservation for 32-bit\nintegers when DPF = 2.

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: full OPUS file bytes
    • \n
    • size: size of data block to decode in bytes
    • \n
    • start: pointer to start location of the data block
    • \n
    • dpf: data-point-format integer stored in corresponding data status block.
    • \n
    \n\n
    Returns:
    \n\n
    \n

    y_array (numpy.ndarray): numpy array of y values contained in the data block

    \n
    \n", "signature": "(filebytes: bytes, size: int, start: int, dpf=1):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.parse_3d_data_block", "modulename": "brukeropus.file.parser", "qualname": "parse_3d_data_block", "kind": "function", "doc": "

    Parses the bytes in a 3D data block (series of spectra) and returns a data dict containing data and metadata.

    \n\n

    3D data blocks are structured differently than standard data blocks. In addition to the series of spectra, they\ninclude metadata for each of the spectrum. This function returns a dict containing all the extracted information\nfrom the data block. The series spectra is formed into a 2D array while metadata captured for each spectra is\nformed into a 1D array (length = number of spectral measurements in the series).

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: full OPUS file bytes
    • \n
    • start: pointer to start location of the data block
    • \n
    • dpf: data-point-format integer stored in corresponding data status block.
    • \n
    \n\n
    Returns:
    \n\n
    \n

    data_dict (dict): dict containing all extracted information from the data block
    \n {
    \n version: file format version number (should be 0)
    \n num_blocks: number of sub blocks; each sub block features a data spectra and associated metadata
    \n offset: offset in bytes to the first sub data block
    \n data_size: size in bytes of each sub data block
    \n info_size: size in bytes of the metadata info block immediately following the sub data block
    \n store_table: run numbers of the first and last blocks to keep track of skipped spectra
    \n y: 2D numpy array containing all spectra (C-order)
    \n metadata arrays: series of metadata arrays in 1D array format (e.g. npt, mny, mxy, tim).\n The most useful one is generally tim, which can be used as the time axis for 3D data plots.
    \n }

    \n
    \n", "signature": "(filebytes: bytes, start: int, dpf: int = 1):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.parse_file_log", "modulename": "brukeropus.file.parser", "qualname": "parse_file_log", "kind": "function", "doc": "

    Parses the file log in an OPUS file and returns a list of strings contained in the log.

    \n\n

    The file log block of an OPUS file contains some information about how the file was generated and edits that have\nbeen performed on the file. This function parses the file log as a list of strings using b'\u0000' as a seperator,\nand does not take any steps to parameterizing what is contained in the log. This log is generally not needed to\nretrieve the file data and metadata, but might be useful for inspecting the file.

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: full OPUS file bytes
    • \n
    • size: size of file log block to decode in bytes
    • \n
    • start: pointer to start location of the file log block
    • \n
    \n\n
    Returns:
    \n\n
    \n

    strings (list): list of strings found in the file log.

    \n
    \n", "signature": "(filebytes: bytes, size: int, start: int):", "funcdef": "def"}, {"fullname": "brukeropus.file.utils", "modulename": "brukeropus.file.utils", "kind": "module", "doc": "

    \n"}, {"fullname": "brukeropus.file.utils.find_opus_files", "modulename": "brukeropus.file.utils", "qualname": "find_opus_files", "kind": "function", "doc": "

    Finds all files in a directory with a strictly numeric extension (OPUS file convention).

    \n\n

    Returns a list of all files in directory that end in .# (e.g. file.0, file.1, file.1001, etc.). Setting recursive\nto true will search directory and all sub directories recursively. No attempt is made to verify the files are\nactually OPUS files (requires opening the file); the function simply looks for files that match the naming pattern.

    \n\n
    Arguments:
    \n\n
      \n
    • directory (str or Path): path indicating directory to search
    • \n
    • recursive: Set to True to recursively search sub directories as well
    • \n
    \n\n
    Returns:
    \n\n
    \n

    filepaths (list): list of filepaths that match OPUS naming convention (numeric extension)

    \n
    \n", "signature": "(directory, recursive: bool = False):", "funcdef": "def"}, {"fullname": "brukeropus.file.utils.get_param_label", "modulename": "brukeropus.file.utils", "qualname": "get_param_label", "kind": "function", "doc": "

    Returns a short but descriptive label for 3-letter parameters. For example, bms returns Beamsplitter.

    \n\n

    The 3-letter parameter input is not case sensitive. This package includes the majority of parameters that OPUS\nuses, but in the event a parameter label is not known, this function will return: \"Unknown XXX\" where XXX is the\nunknown 3-letter parameter.

    \n\n
    Arguments:
    \n\n
      \n
    • param: three letter parameter code (e.g. bms, src, npt, etc.) [not case sensitive]
    • \n
    \n\n
    Returns:
    \n\n
    \n

    label (str): Human-readable string label for the parameter.

    \n
    \n", "signature": "(param: str):", "funcdef": "def"}, {"fullname": "brukeropus.file.utils.get_type_code_label", "modulename": "brukeropus.file.utils", "qualname": "get_type_code_label", "kind": "function", "doc": "

    Returns the type code label of a file block given the position index and value of the type code.

    \n\n

    The file blocks on an OPUS file feature six-integer type codes, for example (3, 1, 1, 2, 0, 0), that categorize the\ncontents of the file block. The positional index defines the category, while the value at that index defines the\nspecific type of that category. For example, the first integer (pos_idx=0), describes the type of data in the\nblock, if applicable:

    \n\n
    0: Undefined or N/A,\n1: Real Part of Complex Data,\n2: Imaginary Part of Complex Data,\n3: Amplitude\n
    \n\n

    This package includes the majority of type codes that OPUS uses, but in the event a type code label is not known,\nthis function will return: \"Unknown 0 4\" where the first number is the position index, and the second is the\nunknown value integer.

    \n\n
    Arguments:
    \n\n
      \n
    • pos_idx: positional index of the type code (0 - 5)
    • \n
    • val: value of the type code
    • \n
    \n\n
    Returns:
    \n\n
    \n

    label (str): human-readable string label that describes the type code.

    \n
    \n", "signature": "(pos_idx: int, val: int):", "funcdef": "def"}, {"fullname": "brukeropus.file.utils.get_block_type_label", "modulename": "brukeropus.file.utils", "qualname": "get_block_type_label", "kind": "function", "doc": "

    Converts a six-integer tuple block type into a human readable label.

    \n\n
    Arguments:
    \n\n
      \n
    • block_type: six integer tuple found in the OPUS file directory that describes the block type
    • \n
    \n\n
    Returns:
    \n\n
    \n

    label (str): human-readable string label

    \n
    \n", "signature": "(block_type: tuple):", "funcdef": "def"}, {"fullname": "brukeropus.file.utils.get_data_key", "modulename": "brukeropus.file.utils", "qualname": "get_data_key", "kind": "function", "doc": "

    Returns a shorthand key for a given data block type: sm, rf, igsm, a, t, r, etc.

    \n\n

    Determines if the data block type is an interferogram, single-channel, absorption, etc. and whether it is associated\nwith the sample or reference channel and returns a shortand key-like label: sm, rf, igsm, igrf, a, t, r, etc. For\nthe full data label (e.g. Sample Spectrum, Absorbance) use: get_block_type_label.\nThis package includes the majority of type codes that OPUS uses, but in the event a type code label is not known,\nthis function will return: \"_33\" or \"sm_33\" where 33 will change to the unkown block_type integer value.

    \n\n
    Arguments:
    \n\n
      \n
    • block_type: six integer tuple found in the OPUS file directory that describes the block type
    • \n
    \n\n
    Returns:
    \n\n
    \n

    key (str): shorthand string label that can be utilized as a data key (e.g. \"sm\", \"igrf\", \"a\")

    \n
    \n", "signature": "(block_type: tuple):", "funcdef": "def"}, {"fullname": "brukeropus.file.utils.parse_file_and_print", "modulename": "brukeropus.file.utils", "qualname": "parse_file_and_print", "kind": "function", "doc": "

    Parses an OPUS file and prints the block information as it goes along to the console.

    \n\n

    This function demonstrates the basic usage and interaction of the parsing functions. It\ncan also be used to diagnose a file parsing issue if one comes up.

    \n\n
    Arguments:
    \n\n
      \n
    • filepath (str or Path): filepath to an OPUS file.
    • \n
    \n", "signature": "(filepath, width=120):", "funcdef": "def"}]; +======= + /** pdoc search index */const docs = [{"fullname": "brukeropus", "modulename": "brukeropus", "kind": "module", "doc": "

    brukeropus is a Python package for interacting with Bruker's OPUS spectroscopy software. Currently, the package can\nread OPUS data files and communicate/control OPUS software using the DDE communication protocol)

    \n\n

    Installation

    \n\n

    brukeropus requires python 3.6+ and numpy, but matplotlib is needed to run the plotting examples. You can\ninstall with pip:

    \n\n
    \n
    pip install brukeropus\n
    \n
    \n\n

    Namespace

    \n\n

    brukeropus provides direct imports to the following:

    \n\n
    \n
    from brukeropus import find_opus_files, read_opus, OPUSFile, Opus\n
    \n
    \n\n

    All other file functions or classes can be directly imported from the brukeropus.file or brukeropus.control\nsubmodules, e.g.:

    \n\n
    \n
    from brukeropus.file import parse_file_and_print\n
    \n
    \n\n

    It is recommended that you do not import from the fully qualified namespace, e.g.:

    \n\n
    \n
    from brukeropus.file.utils import parse_file_and_print\n
    \n
    \n\n

    as that namespace is subject to change. Instead import directly from brukeropus or its first level submodules.

    \n\n

    Reading OPUS Files (Basic Usage)

    \n\n
    \n
    from brukeropus import read_opus\nfrom matplotlib import pyplot as plt\n\nopus_file = read_opus('file.0')  # Returns an OPUSFile class\n\nopus_file.print_parameters()  # Pretty prints all metadata in the file to the console\n\nif 'a' in opus_file.data_keys:  # If absorbance spectra was extracted from file\n    plt.plot(opus_file.a.x, opus_file.a.y)  # Plot absorbance spectra\n    plt.title(opus_file.sfm + ' - ' + opus_file.snm)  # Sets plot title to Sample Form - Sample Name\n    plt.show()  # Display plot\n
    \n
    \n\n

    More detailed documentation on the file submodule can be found in brukeropus.file

    \n\n

    Controlling OPUS Software (Basic Usage)

    \n\n
    \n
    from brukeropus import opus, read_opus\nfrom matplotlib import pyplot as plt\n\nopus = Opus()  # Connects to actively running OPUS software\n\napt_options = opus.get_param_options('apt') # Get all valid aperture settings\n\nfor apt in apt_options[2:-2]: # Loop over all but the two smallest and two largest aperature settings\n    filepath = opus.measure_sample(apt=apt, nss=10, unload=True) # Perform measurement and unload file from OPUS\n    data = read_opus(filepath) # Read OPUS file from measurement\n    plt.plot(data.sm.x, data.sm.y, label=apt) # Plot single-channel sample spectra\nplt.legend()\nplt.show()\n
    \n
    \n\n

    More detailed documentation on the control submodule can be found in brukeropus.control.

    \n"}, {"fullname": "brukeropus.control", "modulename": "brukeropus.control", "kind": "module", "doc": "

    The brukeropus.control submodule of brukeropus includes the Opus class for communicating with OPUS software. The\nOpus class currently supports communication through the Dynamic Data Exchange (DDE) protocol. This class can be used\nto script measurement sweeps and perform various low-level operations (e.g. move mirrors, rotate polarizers, etc.). In\norder to communicate with OPUS, the software must be open, logged in, and running on the same PC as brukeropus.

    \n\n

    Initializing/verifying connection to OPUS Software

    \n\n
    \n
    from brukeropus import Opus\n\nopus = Opus()  # initialization of class automatically connects to open OPUS software\nprint(opus.get_version())  # prints the current OPUS software version\n
    \n
    \n\n

    Get information about a parameter (e.g. DTC, APT, VEL).

    \n\n
    \n
    opus = Opus()\nparam = 'vel'\nprint(opus.get_param_label(param))\nprint(opus.get_param_options(param))\n
    \n
    \n\n

    Perform a measurement sweep

    \n\n
    \n
    from brukeropus import opus, read_opus\nfrom matplotlib import pyplot as plt\n\nopus = Opus()  # Connects to actively running OPUS software\n\napt_options = opus.get_param_options('apt') # Get all valid aperture settings\n\nfor apt in apt_options[2:-2]: # Loop over all but the two smallest and two largest aperature settings\n    filepath = opus.measure_sample(apt=apt, nss=10, unload=True) # Perform measurement and unload file from OPUS\n    data = read_opus(filepath) # Read OPUS file from measurement\n    plt.plot(data.sm.x, data.sm.y, label=apt) # Plot single-channel sample spectra\nplt.legend()\nplt.show()\n
    \n
    \n\n

    For complete Opus documentation, see: brukeropus.control.opus

    \n"}, {"fullname": "brukeropus.control.dde", "modulename": "brukeropus.control.dde", "kind": "module", "doc": "

    \n"}, {"fullname": "brukeropus.control.dde.HCONV", "modulename": "brukeropus.control.dde", "qualname": "HCONV", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.c_void_p'>"}, {"fullname": "brukeropus.control.dde.HDDEDATA", "modulename": "brukeropus.control.dde", "qualname": "HDDEDATA", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.c_void_p'>"}, {"fullname": "brukeropus.control.dde.HSZ", "modulename": "brukeropus.control.dde", "qualname": "HSZ", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.c_void_p'>"}, {"fullname": "brukeropus.control.dde.LPBYTE", "modulename": "brukeropus.control.dde", "qualname": "LPBYTE", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.c_char_p'>"}, {"fullname": "brukeropus.control.dde.LPDWORD", "modulename": "brukeropus.control.dde", "qualname": "LPDWORD", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.wintypes.LP_c_ulong'>"}, {"fullname": "brukeropus.control.dde.LPSTR", "modulename": "brukeropus.control.dde", "qualname": "LPSTR", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.c_char_p'>"}, {"fullname": "brukeropus.control.dde.ULONG_PTR", "modulename": "brukeropus.control.dde", "qualname": "ULONG_PTR", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.c_ulong'>"}, {"fullname": "brukeropus.control.dde.PCONVCONTEXT", "modulename": "brukeropus.control.dde", "qualname": "PCONVCONTEXT", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.c_void_p'>"}, {"fullname": "brukeropus.control.dde.DMLERR_NO_ERROR", "modulename": "brukeropus.control.dde", "qualname": "DMLERR_NO_ERROR", "kind": "variable", "doc": "

    \n", "default_value": "0"}, {"fullname": "brukeropus.control.dde.CF_TEXT", "modulename": "brukeropus.control.dde", "qualname": "CF_TEXT", "kind": "variable", "doc": "

    \n", "default_value": "1"}, {"fullname": "brukeropus.control.dde.CF_BITMAP", "modulename": "brukeropus.control.dde", "qualname": "CF_BITMAP", "kind": "variable", "doc": "

    \n", "default_value": "2"}, {"fullname": "brukeropus.control.dde.CF_METAFILEPICT", "modulename": "brukeropus.control.dde", "qualname": "CF_METAFILEPICT", "kind": "variable", "doc": "

    \n", "default_value": "3"}, {"fullname": "brukeropus.control.dde.CF_SYLK", "modulename": "brukeropus.control.dde", "qualname": "CF_SYLK", "kind": "variable", "doc": "

    \n", "default_value": "4"}, {"fullname": "brukeropus.control.dde.CF_DIF", "modulename": "brukeropus.control.dde", "qualname": "CF_DIF", "kind": "variable", "doc": "

    \n", "default_value": "5"}, {"fullname": "brukeropus.control.dde.CF_TIFF", "modulename": "brukeropus.control.dde", "qualname": "CF_TIFF", "kind": "variable", "doc": "

    \n", "default_value": "6"}, {"fullname": "brukeropus.control.dde.CF_OEMTEXT", "modulename": "brukeropus.control.dde", "qualname": "CF_OEMTEXT", "kind": "variable", "doc": "

    \n", "default_value": "7"}, {"fullname": "brukeropus.control.dde.CF_DIB", "modulename": "brukeropus.control.dde", "qualname": "CF_DIB", "kind": "variable", "doc": "

    \n", "default_value": "8"}, {"fullname": "brukeropus.control.dde.CF_PALETTE", "modulename": "brukeropus.control.dde", "qualname": "CF_PALETTE", "kind": "variable", "doc": "

    \n", "default_value": "9"}, {"fullname": "brukeropus.control.dde.CF_PENDATA", "modulename": "brukeropus.control.dde", "qualname": "CF_PENDATA", "kind": "variable", "doc": "

    \n", "default_value": "10"}, {"fullname": "brukeropus.control.dde.CF_RIFF", "modulename": "brukeropus.control.dde", "qualname": "CF_RIFF", "kind": "variable", "doc": "

    \n", "default_value": "11"}, {"fullname": "brukeropus.control.dde.CF_WAVE", "modulename": "brukeropus.control.dde", "qualname": "CF_WAVE", "kind": "variable", "doc": "

    \n", "default_value": "12"}, {"fullname": "brukeropus.control.dde.CF_UNICODETEXT", "modulename": "brukeropus.control.dde", "qualname": "CF_UNICODETEXT", "kind": "variable", "doc": "

    \n", "default_value": "13"}, {"fullname": "brukeropus.control.dde.CF_ENHMETAFILE", "modulename": "brukeropus.control.dde", "qualname": "CF_ENHMETAFILE", "kind": "variable", "doc": "

    \n", "default_value": "14"}, {"fullname": "brukeropus.control.dde.CF_HDROP", "modulename": "brukeropus.control.dde", "qualname": "CF_HDROP", "kind": "variable", "doc": "

    \n", "default_value": "15"}, {"fullname": "brukeropus.control.dde.CF_LOCALE", "modulename": "brukeropus.control.dde", "qualname": "CF_LOCALE", "kind": "variable", "doc": "

    \n", "default_value": "16"}, {"fullname": "brukeropus.control.dde.CF_DIBV5", "modulename": "brukeropus.control.dde", "qualname": "CF_DIBV5", "kind": "variable", "doc": "

    \n", "default_value": "17"}, {"fullname": "brukeropus.control.dde.CF_MAX", "modulename": "brukeropus.control.dde", "qualname": "CF_MAX", "kind": "variable", "doc": "

    \n", "default_value": "18"}, {"fullname": "brukeropus.control.dde.DDE_FACK", "modulename": "brukeropus.control.dde", "qualname": "DDE_FACK", "kind": "variable", "doc": "

    \n", "default_value": "32768"}, {"fullname": "brukeropus.control.dde.DDE_FBUSY", "modulename": "brukeropus.control.dde", "qualname": "DDE_FBUSY", "kind": "variable", "doc": "

    \n", "default_value": "16384"}, {"fullname": "brukeropus.control.dde.DDE_FDEFERUPD", "modulename": "brukeropus.control.dde", "qualname": "DDE_FDEFERUPD", "kind": "variable", "doc": "

    \n", "default_value": "16384"}, {"fullname": "brukeropus.control.dde.DDE_FACKREQ", "modulename": "brukeropus.control.dde", "qualname": "DDE_FACKREQ", "kind": "variable", "doc": "

    \n", "default_value": "32768"}, {"fullname": "brukeropus.control.dde.DDE_FRELEASE", "modulename": "brukeropus.control.dde", "qualname": "DDE_FRELEASE", "kind": "variable", "doc": "

    \n", "default_value": "8192"}, {"fullname": "brukeropus.control.dde.DDE_FREQUESTED", "modulename": "brukeropus.control.dde", "qualname": "DDE_FREQUESTED", "kind": "variable", "doc": "

    \n", "default_value": "4096"}, {"fullname": "brukeropus.control.dde.DDE_FAPPSTATUS", "modulename": "brukeropus.control.dde", "qualname": "DDE_FAPPSTATUS", "kind": "variable", "doc": "

    \n", "default_value": "255"}, {"fullname": "brukeropus.control.dde.DDE_FNOTPROCESSED", "modulename": "brukeropus.control.dde", "qualname": "DDE_FNOTPROCESSED", "kind": "variable", "doc": "

    \n", "default_value": "0"}, {"fullname": "brukeropus.control.dde.DDE_FACKRESERVED", "modulename": "brukeropus.control.dde", "qualname": "DDE_FACKRESERVED", "kind": "variable", "doc": "

    \n", "default_value": "-49408"}, {"fullname": "brukeropus.control.dde.DDE_FADVRESERVED", "modulename": "brukeropus.control.dde", "qualname": "DDE_FADVRESERVED", "kind": "variable", "doc": "

    \n", "default_value": "-49153"}, {"fullname": "brukeropus.control.dde.DDE_FDATRESERVED", "modulename": "brukeropus.control.dde", "qualname": "DDE_FDATRESERVED", "kind": "variable", "doc": "

    \n", "default_value": "-45057"}, {"fullname": "brukeropus.control.dde.DDE_FPOKRESERVED", "modulename": "brukeropus.control.dde", "qualname": "DDE_FPOKRESERVED", "kind": "variable", "doc": "

    \n", "default_value": "-8193"}, {"fullname": "brukeropus.control.dde.XTYPF_NOBLOCK", "modulename": "brukeropus.control.dde", "qualname": "XTYPF_NOBLOCK", "kind": "variable", "doc": "

    \n", "default_value": "2"}, {"fullname": "brukeropus.control.dde.XTYPF_NODATA", "modulename": "brukeropus.control.dde", "qualname": "XTYPF_NODATA", "kind": "variable", "doc": "

    \n", "default_value": "4"}, {"fullname": "brukeropus.control.dde.XTYPF_ACKREQ", "modulename": "brukeropus.control.dde", "qualname": "XTYPF_ACKREQ", "kind": "variable", "doc": "

    \n", "default_value": "8"}, {"fullname": "brukeropus.control.dde.XCLASS_MASK", "modulename": "brukeropus.control.dde", "qualname": "XCLASS_MASK", "kind": "variable", "doc": "

    \n", "default_value": "64512"}, {"fullname": "brukeropus.control.dde.XCLASS_BOOL", "modulename": "brukeropus.control.dde", "qualname": "XCLASS_BOOL", "kind": "variable", "doc": "

    \n", "default_value": "4096"}, {"fullname": "brukeropus.control.dde.XCLASS_DATA", "modulename": "brukeropus.control.dde", "qualname": "XCLASS_DATA", "kind": "variable", "doc": "

    \n", "default_value": "8192"}, {"fullname": "brukeropus.control.dde.XCLASS_FLAGS", "modulename": "brukeropus.control.dde", "qualname": "XCLASS_FLAGS", "kind": "variable", "doc": "

    \n", "default_value": "16384"}, {"fullname": "brukeropus.control.dde.XCLASS_NOTIFICATION", "modulename": "brukeropus.control.dde", "qualname": "XCLASS_NOTIFICATION", "kind": "variable", "doc": "

    \n", "default_value": "32768"}, {"fullname": "brukeropus.control.dde.XTYP_ERROR", "modulename": "brukeropus.control.dde", "qualname": "XTYP_ERROR", "kind": "variable", "doc": "

    \n", "default_value": "32770"}, {"fullname": "brukeropus.control.dde.XTYP_ADVDATA", "modulename": "brukeropus.control.dde", "qualname": "XTYP_ADVDATA", "kind": "variable", "doc": "

    \n", "default_value": "16400"}, {"fullname": "brukeropus.control.dde.XTYP_ADVREQ", "modulename": "brukeropus.control.dde", "qualname": "XTYP_ADVREQ", "kind": "variable", "doc": "

    \n", "default_value": "8226"}, {"fullname": "brukeropus.control.dde.XTYP_ADVSTART", "modulename": "brukeropus.control.dde", "qualname": "XTYP_ADVSTART", "kind": "variable", "doc": "

    \n", "default_value": "4144"}, {"fullname": "brukeropus.control.dde.XTYP_ADVSTOP", "modulename": "brukeropus.control.dde", "qualname": "XTYP_ADVSTOP", "kind": "variable", "doc": "

    \n", "default_value": "32832"}, {"fullname": "brukeropus.control.dde.XTYP_EXECUTE", "modulename": "brukeropus.control.dde", "qualname": "XTYP_EXECUTE", "kind": "variable", "doc": "

    \n", "default_value": "16464"}, {"fullname": "brukeropus.control.dde.XTYP_CONNECT", "modulename": "brukeropus.control.dde", "qualname": "XTYP_CONNECT", "kind": "variable", "doc": "

    \n", "default_value": "4194"}, {"fullname": "brukeropus.control.dde.XTYP_CONNECT_CONFIRM", "modulename": "brukeropus.control.dde", "qualname": "XTYP_CONNECT_CONFIRM", "kind": "variable", "doc": "

    \n", "default_value": "32882"}, {"fullname": "brukeropus.control.dde.XTYP_XACT_COMPLETE", "modulename": "brukeropus.control.dde", "qualname": "XTYP_XACT_COMPLETE", "kind": "variable", "doc": "

    \n", "default_value": "32896"}, {"fullname": "brukeropus.control.dde.XTYP_POKE", "modulename": "brukeropus.control.dde", "qualname": "XTYP_POKE", "kind": "variable", "doc": "

    \n", "default_value": "16528"}, {"fullname": "brukeropus.control.dde.XTYP_REGISTER", "modulename": "brukeropus.control.dde", "qualname": "XTYP_REGISTER", "kind": "variable", "doc": "

    \n", "default_value": "32930"}, {"fullname": "brukeropus.control.dde.XTYP_REQUEST", "modulename": "brukeropus.control.dde", "qualname": "XTYP_REQUEST", "kind": "variable", "doc": "

    \n", "default_value": "8368"}, {"fullname": "brukeropus.control.dde.XTYP_DISCONNECT", "modulename": "brukeropus.control.dde", "qualname": "XTYP_DISCONNECT", "kind": "variable", "doc": "

    \n", "default_value": "32962"}, {"fullname": "brukeropus.control.dde.XTYP_UNREGISTER", "modulename": "brukeropus.control.dde", "qualname": "XTYP_UNREGISTER", "kind": "variable", "doc": "

    \n", "default_value": "32978"}, {"fullname": "brukeropus.control.dde.XTYP_WILDCONNECT", "modulename": "brukeropus.control.dde", "qualname": "XTYP_WILDCONNECT", "kind": "variable", "doc": "

    \n", "default_value": "8418"}, {"fullname": "brukeropus.control.dde.XTYP_MONITOR", "modulename": "brukeropus.control.dde", "qualname": "XTYP_MONITOR", "kind": "variable", "doc": "

    \n", "default_value": "33010"}, {"fullname": "brukeropus.control.dde.XTYP_MASK", "modulename": "brukeropus.control.dde", "qualname": "XTYP_MASK", "kind": "variable", "doc": "

    \n", "default_value": "240"}, {"fullname": "brukeropus.control.dde.XTYP_SHIFT", "modulename": "brukeropus.control.dde", "qualname": "XTYP_SHIFT", "kind": "variable", "doc": "

    \n", "default_value": "4"}, {"fullname": "brukeropus.control.dde.TIMEOUT_ASYNC", "modulename": "brukeropus.control.dde", "qualname": "TIMEOUT_ASYNC", "kind": "variable", "doc": "

    \n", "default_value": "4294967295"}, {"fullname": "brukeropus.control.dde.get_winfunc", "modulename": "brukeropus.control.dde", "qualname": "get_winfunc", "kind": "function", "doc": "

    Retrieve a function from a library, and set the data types.

    \n", "signature": "(\tlibname,\tfuncname,\trestype=None,\targtypes=(),\t_libcache={'user32': <WinDLL 'user32', handle 7fff631d0000>}):", "funcdef": "def"}, {"fullname": "brukeropus.control.dde.DDECALLBACK", "modulename": "brukeropus.control.dde", "qualname": "DDECALLBACK", "kind": "variable", "doc": "

    \n", "default_value": "<class 'ctypes.WINFUNCTYPE.<locals>.WinFunctionType'>"}, {"fullname": "brukeropus.control.dde.DDE", "modulename": "brukeropus.control.dde", "qualname": "DDE", "kind": "class", "doc": "

    Object containing all the DDE functions

    \n"}, {"fullname": "brukeropus.control.dde.DDE.AccessData", "modulename": "brukeropus.control.dde", "qualname": "DDE.AccessData", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.ClientTransaction", "modulename": "brukeropus.control.dde", "qualname": "DDE.ClientTransaction", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.Connect", "modulename": "brukeropus.control.dde", "qualname": "DDE.Connect", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.CreateStringHandle", "modulename": "brukeropus.control.dde", "qualname": "DDE.CreateStringHandle", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.Disconnect", "modulename": "brukeropus.control.dde", "qualname": "DDE.Disconnect", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.GetLastError", "modulename": "brukeropus.control.dde", "qualname": "DDE.GetLastError", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.Initialize", "modulename": "brukeropus.control.dde", "qualname": "DDE.Initialize", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.FreeDataHandle", "modulename": "brukeropus.control.dde", "qualname": "DDE.FreeDataHandle", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.FreeStringHandle", "modulename": "brukeropus.control.dde", "qualname": "DDE.FreeStringHandle", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.QueryString", "modulename": "brukeropus.control.dde", "qualname": "DDE.QueryString", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.UnaccessData", "modulename": "brukeropus.control.dde", "qualname": "DDE.UnaccessData", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDE.Uninitialize", "modulename": "brukeropus.control.dde", "qualname": "DDE.Uninitialize", "kind": "variable", "doc": "

    \n", "default_value": "<_FuncPtr object>"}, {"fullname": "brukeropus.control.dde.DDEError", "modulename": "brukeropus.control.dde", "qualname": "DDEError", "kind": "class", "doc": "

    Exception raise when a DDE errpr occures.

    \n", "bases": "builtins.RuntimeError"}, {"fullname": "brukeropus.control.dde.DDEError.__init__", "modulename": "brukeropus.control.dde", "qualname": "DDEError.__init__", "kind": "function", "doc": "

    \n", "signature": "(msg, idInst=None)"}, {"fullname": "brukeropus.control.dde.DDEClient", "modulename": "brukeropus.control.dde", "qualname": "DDEClient", "kind": "class", "doc": "

    The DDEClient class.

    \n\n

    Use this class to create and manage a connection to a service/topic. To get\nclassbacks subclass DDEClient and overwrite callback.

    \n"}, {"fullname": "brukeropus.control.dde.DDEClient.__init__", "modulename": "brukeropus.control.dde", "qualname": "DDEClient.__init__", "kind": "function", "doc": "

    Create a connection to a service/topic.

    \n", "signature": "(service, topic)"}, {"fullname": "brukeropus.control.dde.DDEClient.advise", "modulename": "brukeropus.control.dde", "qualname": "DDEClient.advise", "kind": "function", "doc": "

    Request updates when DDE data changes.

    \n", "signature": "(self, item, stop=False):", "funcdef": "def"}, {"fullname": "brukeropus.control.dde.DDEClient.execute", "modulename": "brukeropus.control.dde", "qualname": "DDEClient.execute", "kind": "function", "doc": "

    Execute a DDE command.

    \n", "signature": "(self, command, timeout=5000):", "funcdef": "def"}, {"fullname": "brukeropus.control.dde.DDEClient.request", "modulename": "brukeropus.control.dde", "qualname": "DDEClient.request", "kind": "function", "doc": "

    Request data from DDE service.

    \n", "signature": "(self, item, timeout=5000):", "funcdef": "def"}, {"fullname": "brukeropus.control.dde.DDEClient.callback", "modulename": "brukeropus.control.dde", "qualname": "DDEClient.callback", "kind": "function", "doc": "

    Calback function for advice.

    \n", "signature": "(self, value, item=None):", "funcdef": "def"}, {"fullname": "brukeropus.control.dde.WinMSGLoop", "modulename": "brukeropus.control.dde", "qualname": "WinMSGLoop", "kind": "function", "doc": "

    Run the main windows message loop.

    \n", "signature": "():", "funcdef": "def"}, {"fullname": "brukeropus.control.opus", "modulename": "brukeropus.control.opus", "kind": "module", "doc": "

    \n"}, {"fullname": "brukeropus.control.opus.ERROR_CODES", "modulename": "brukeropus.control.opus", "qualname": "ERROR_CODES", "kind": "variable", "doc": "

    \n", "default_value": "{1: 'Not an Opus Command', 2: 'Unknown Opus Command', 3: 'Missing Square Bracket in Command', 4: 'Function Not Available (Possible missing parameter)', 5: 'Parameter Name Is Incorrect', 6: 'Parameter Set Is Incomplete', 7: 'File Parameter Is Incorrectly Formatted', 8: 'File(s) Missing Or Corrupt', 9: 'Opus Could Not Complete The Command'}"}, {"fullname": "brukeropus.control.opus.Opus", "modulename": "brukeropus.control.opus", "qualname": "Opus", "kind": "class", "doc": "

    Class for communicating with currently running OPUS software using DDE interface. Class automatically attempts\nto connect to OPUS software upon initialization.

    \n"}, {"fullname": "brukeropus.control.opus.Opus.dde", "modulename": "brukeropus.control.opus", "qualname": "Opus.dde", "kind": "variable", "doc": "

    \n", "default_value": "None"}, {"fullname": "brukeropus.control.opus.Opus.connected", "modulename": "brukeropus.control.opus", "qualname": "Opus.connected", "kind": "variable", "doc": "

    \n", "default_value": "False"}, {"fullname": "brukeropus.control.opus.Opus.error_string", "modulename": "brukeropus.control.opus", "qualname": "Opus.error_string", "kind": "variable", "doc": "

    \n", "default_value": "'Error'"}, {"fullname": "brukeropus.control.opus.Opus.connect", "modulename": "brukeropus.control.opus", "qualname": "Opus.connect", "kind": "function", "doc": "

    Connects class to OPUS software through the DDE interface. Sets the connected attribute to True if\nsuccessful. By default, initializing an Opus class will automatically attempt to connect to OPUS.

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.disconnect", "modulename": "brukeropus.control.opus", "qualname": "Opus.disconnect", "kind": "function", "doc": "

    Disconnects DDE client/server connection.

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.raw_query", "modulename": "brukeropus.control.opus", "qualname": "Opus.raw_query", "kind": "function", "doc": "

    Sends command/request string (req_str) to OPUS and returns the response in byte format.

    \n\n
    Arguments:
    \n\n
      \n
    • req_str: The request string to send to OPUS over DDE
    • \n
    • timeout: timeout in milliseconds. If a response is not recieved within the timeout period, an exception is\nraised.
    • \n
    \n\n
    Returns:
    \n\n
    \n

    response: response from OPUS software through DDE request in bytes format.

    \n
    \n", "signature": "(self, req_str: str, timeout=10000):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.parse_response", "modulename": "brukeropus.control.opus", "qualname": "Opus.parse_response", "kind": "function", "doc": "

    Parses the byte response from a raw DDE request query. If an error is detected in the request, an Exception\nis raised. If successful, a boolean, string or list of strings will be returned as appropriate.

    \n\n
    Arguments:
    \n\n
      \n
    • byte_response: response from OPUS software through DDE request in bytes format.
    • \n
    • decode: format used to decode bytes into string (e.g. 'ascii' or 'utf-8')
    • \n
    \n\n
    Returns:
    \n\n
    \n

    response: parsed response from OPUS software (bool, string, or list of strings depending on request)

    \n
    \n", "signature": "(self, byte_response: bytes, decode='ascii'):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.query", "modulename": "brukeropus.control.opus", "qualname": "Opus.query", "kind": "function", "doc": "

    Sends a command/request and returns the parsed response.

    \n\n
    Arguments:
    \n\n
      \n
    • req_str: The request string to send to OPUS over DDE
    • \n
    • timeout: timeout in milliseconds. If a response is not recieved within the timeout period, an exception is\nraised.
    • \n
    • decode: format used to decode bytes into string (e.g. 'ascii' or 'utf-8')
    • \n
    \n\n
    Returns:
    \n\n
    \n

    response: parsed response from OPUS software (bool, string, or list of strings depending on request)

    \n
    \n", "signature": "(self, req_str: str, timeout=10000, decode='ascii'):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.close_opus", "modulename": "brukeropus.control.opus", "qualname": "Opus.close_opus", "kind": "function", "doc": "

    Closes the OPUS application. Returns True if successful.

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.get_param_label", "modulename": "brukeropus.control.opus", "qualname": "Opus.get_param_label", "kind": "function", "doc": "

    Get the label for a three character parameter code (e.g. BMS, APT, DTC, etc...).

    \n\n
    Arguments:
    \n\n
      \n
    • param: three character parameter code (case insensitive)
    • \n
    \n\n
    Returns:
    \n\n
    \n

    label: short descriptive label that defines the parameter

    \n
    \n", "signature": "(self, param: str):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.get_param_options", "modulename": "brukeropus.control.opus", "qualname": "Opus.get_param_options", "kind": "function", "doc": "

    Get the parameter setting options for a three character parameter code. Only valid for\nenum type parameters (e.g. BMS, APT, DTC, etc...).

    \n\n
    Arguments:
    \n\n
      \n
    • param: three character parameter code (case insensitive)
    • \n
    \n\n
    Returns:
    \n\n
    \n

    options: list of valid options (strings) for the given parameter

    \n
    \n", "signature": "(self, param: str):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.get_version", "modulename": "brukeropus.control.opus", "qualname": "Opus.get_version", "kind": "function", "doc": "

    Get the OPUS software version information

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.get_opus_path", "modulename": "brukeropus.control.opus", "qualname": "Opus.get_opus_path", "kind": "function", "doc": "

    Get the absolute path to the OPUS software directory (where PARAMTEXT.bin and other instrument specific files\nare located)

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.send_command", "modulename": "brukeropus.control.opus", "qualname": "Opus.send_command", "kind": "function", "doc": "

    Used to send \"Direct Commands\" to the optics bench. Useful for manually moving motors, etc. from accessories\nand other low-level operations such as controlling the scanning mirror movement.

    \n\n
    Examples:
    \n\n
    \n

    send_command('VAC=5') # vents the sample compartment\n send_command('VAC=4') # evacuates sample compartment

    \n
    \n\n
    Arguments:
    \n\n
      \n
    • text_command: string command as you would enter into \"Direct Command\" input of OPUS
    • \n
    • timeout: timeout in milliseconds to wait for response
    • \n
    \n\n
    Returns:
    \n\n
    \n

    response: parsed response from OPUS software (typically boolean confirmation)

    \n
    \n", "signature": "(self, text_command: str, timeout=10000):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.evacuate_sample", "modulename": "brukeropus.control.opus", "qualname": "Opus.evacuate_sample", "kind": "function", "doc": "

    Evacuates the sample compartment

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.vent_sample", "modulename": "brukeropus.control.opus", "qualname": "Opus.vent_sample", "kind": "function", "doc": "

    Vents the sample compartment

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.close_flaps", "modulename": "brukeropus.control.opus", "qualname": "Opus.close_flaps", "kind": "function", "doc": "

    Closes vacumm flaps between optics bench and sample compartment

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.open_flaps", "modulename": "brukeropus.control.opus", "qualname": "Opus.open_flaps", "kind": "function", "doc": "

    Opens vacumm flaps between optics bench and sample compartment

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.unload_file", "modulename": "brukeropus.control.opus", "qualname": "Opus.unload_file", "kind": "function", "doc": "

    Unloads a file from the OPUS software from its filepath

    \n\n
    Arguments:
    \n\n
      \n
    • filepath: full path of the file to be unloaded in the software.
    • \n
    \n\n
    Returns:
    \n\n
    \n

    response: True if successful.

    \n
    \n", "signature": "(self, filepath: str):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.unload_all", "modulename": "brukeropus.control.opus", "qualname": "Opus.unload_all", "kind": "function", "doc": "

    Unloads all files from OPUS software

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.measure_ref", "modulename": "brukeropus.control.opus", "qualname": "Opus.measure_ref", "kind": "function", "doc": "

    Takes a reference measurement using the current settings from advanced experiment. Also\ntakes option **kwargs input which use the OPUS 3-letter parameter keys and values as input\nto customize the measurement. example:

    \n\n
    measure_ref(nrs=100, res=4) # measures reference with current settings but overriding averages to 100 and\n    resolution to 4\n
    \n\n
    Arguments:
    \n\n
      \n
    • timeout: timeout in milliseconds to wait for response
    • \n
    • kwargs: any valid three character parameter code (case insensitive)
    • \n
    \n\n
    Returns:
    \n\n
    \n

    response: True if successful

    \n
    \n", "signature": "(self, timeout=1000000, **kwargs):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.measure_sample", "modulename": "brukeropus.control.opus", "qualname": "Opus.measure_sample", "kind": "function", "doc": "

    Takes a reference measurement using the current settings from advanced experiment. Also\ntakes option **kwargs input which use the OPUS 3-letter parameter keys and values as input\nto customize the measurement. example:

    \n\n
    measure_sample(nss=100, res=4) # measures sample with current settings but overriding averages to 100 and\n    resolution to 4\n
    \n\n
    Arguments:
    \n\n
      \n
    • unload: whether to unload the file from OPUS after measurement is complete (to allow moving/renaming, etc.)
    • \n
    • timeout: timeout in milliseconds to wait for response
    • \n
    • kwargs: any valid three character parameter code (case insensitive)
    • \n
    \n\n
    Returns:
    \n\n
    \n

    filepath: absolute filepath to measured sample file

    \n
    \n", "signature": "(self, unload=False, timeout=1000000, **kwargs):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.check_signal", "modulename": "brukeropus.control.opus", "qualname": "Opus.check_signal", "kind": "function", "doc": "

    Performs a quick (typically 1 sample) measurement using the current FTIR settings. Current settings can be\noverridden using **kwargs. After measurement is finished, the file is unloaded from OPUS and deleted. The\nfunction returns an OPUSFile object before it deletes the quick measurement file.

    \n\n
    Arguments:
    \n\n
      \n
    • nss: number of sample scans to average (default is 1, i.e. no averaging)
    • \n
    • kwargs: any valid three character parameter code (case insensitive)
    • \n
    \n\n
    Returns:
    \n\n
    \n

    opus_file: OPUSFile object generated by quick measurement

    \n
    \n", "signature": "(self, nss=1, **kwargs):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.save_ref", "modulename": "brukeropus.control.opus", "qualname": "Opus.save_ref", "kind": "function", "doc": "

    Saves current reference to file (according to current filename and path set in advanced experiment) and\nreturns the filename.

    \n\n
    Returns:
    \n\n
    \n

    filepath: absolute path to saved reference file

    \n
    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file", "modulename": "brukeropus.file", "kind": "module", "doc": "

    The brukeropus.file submodule of brukeropus includes all the functions and classes for reading and exploring OPUS\nfiles. This includes both high-level functions like read_opus that returns an OPUSFile class, as well as low-level\nparsing functions like parse_directory that returns data extracted directly from the binary OPUS file bytes. This\noverview documentation will focus on the high-level functions which will be useful for most users. If you are\ninterested in using the low-level parsing functions, perhaps to make your own data class or customize how files are\nread, refer to: brukeropus.file.parser which contains all the low-level parsing functions.

    \n\n

    Finding OPUS Files

    \n\n

    OPUS files are typically saved with a numeric file extension (e.g. file.0, file.1, file.1001). This makes searching for\na list of OPUS files in a directory a little more cumbersome than a traditional \"*.csv\" search. To address this,\nbrukeropus includes a find_opus_files function:

    \n\n
    \n
    from brukeropus import find_opus_files\n\nfilepaths = find_opus_files(r'path\\to\\opus\\files', recursive=True)\n
    \n
    \n\n

    Which will assign a list of filepaths that match the numeric extension formatting of OPUS files. For full documentation,\nsee brukeropus.file.utils.find_opus_files.

    \n\n

    Reading OPUS Files

    \n\n

    brukeropus parses OPUS files and assembles them into an OPUSFile object that contains the extracted data (and\nmetadata) within the file. You can generate an OPUSFile object in one of two ways:

    \n\n
    \n
    from brukeropus import read_opus, OPUSFile\n\nfilepath = r'path\\to\\opusfile.0'\n\ndata = read_opus(filepath)\nsame_data = OPUSFile(filepath)\n
    \n
    \n\n

    In the above code, data and same_data are both OPUSFile objects with identical data.

    \n\n

    Using the OPUSFile Class

    \n\n

    OPUS files all start with the same first four magic bytes. If the file does not start with these bytes (i.e. is not\na valid OPUS file), the OPUSFile class will logically evaluate to false:

    \n\n
    \n
    data = read_opus('file.pdf')\nif data:\n    print(data)\nelse:\n    print(data.filepath, 'is not an OPUS file')\n
    \n
    \n\n

    To view all parameter metadata in the file, you can print to the console using the class method: print_parameters.\nThis will let you view all the key, value parameter data extracted from the file with labels for what the parameter keys\nare referring to wherever known.

    \n\n
    \n
    data = read_opus('file.0')\ndata.print_parameters()\n
    \n
    \n\n

    \nExample print_parameters Output

    \n\n

    \n

    \n
    ====================================================================================================\n                                         Optical Parameters\nKey    Label                                   Value\nACC    Accessory                               TRANS *010A984F\nAPR    ATR Pressure                            0\nAPT    Aperture Setting                        1 mm\nBMS    Beamsplitter                            KBr-Broadband\nCHN    Measurement Channel                     Sample Compartment\nDTC    Detector                                RT-DLaTGS [Internal Pos.1]\nHPF    High Pass Filter                        0\nLPF    Low Pass Filter                         10.0\nLPV    Variable Low Pass Filter (cm-1)         4000\nOPF    Optical Filter Setting                  Open\nPGN    Preamplifier Gain                       3\nRDX    Extended Ready Check                    0\nSRC    Source                                  MIR\nVEL    Scanner Velocity                        10.0\nADC    External Analog Signals                 0\nSON    External Sync                           Off\n\n====================================================================================================\n                                    Fourier Transform Parameters\nKey    Label                                   Value\nAPF    Apodization Function                    B3\nHFQ    End Frequency Limit for File            500.0\nLFQ    Start Frequency Limit for File          10000.0\nNLI    Nonlinearity Correction                 0\nPHR    Phase Resolution                        100.0\nPHZ    Phase Correction Mode                   ML\nSPZ    Stored Phase Mode                       NO\nZFF    Zero Filling Factor                     2\n\n====================================================================================================\n                                       Acquisition Parameters\nKey    Label                                   Value\nADT    Additional Data Treatment               0\nAQM    Acquisition Mode                        DD\nCFE    Low Intensity Power Mode with DTGS      0\nCOR    Correlation Test Mode                   0\nDEL    Delay Before Measurement                0\nDLY    Stabilization Delay                     0\nHFW    Wanted High Freq Limit                  15000.0\nLFW    Wanted Low Freq Limit                   0.0\nNSS    Number of Sample Scans                  50\nPLF    Result Spectrum Type                    AB\nRES    Resolution (cm-1)                       4.0\nSOT    Sample Scans or Time                    0\nTCL    Command Line for Additional Data Tr...\nTDL    To Do List                              16777271\nSGN    Sample Signal Gain                      1\n\n====================================================================================================\n                                      Sample Origin Parameters\nKey    Label                                   Value\nBLD    Building\nCNM    Operator Name                           Duran\nCPY    Company\nDPM    Department\nEXP    Experiment                              MWIR-LWIR_Trans_FileNameFormat.XPM\nLCT    Location\nSFM    Sample Form                             Atm-MWIR (All A)\nSNM    Sample Name                             File Test\nXPP    Experiment Path                         C:\\Users\\Public\\Documents\\Bruker\\OPUS_8.1.29\\XPM\nIST    Instrument Status                       OK\nCPG    Character Encoding Code Page            1252\nUID    Universally Unique Identifier           0d1348c2-3a2c-41c9-b521-bdaf0a23710c\n\n====================================================================================================\n                                    Instrument Status Parameters\nKey    Label                                   Value\nHFL    High Folding Limit                      15795.820598\nLFL    Low Folding Limit                       0.0\nLWN    Laser Wavenumber                        15795.820598\nABP    Absolute Peak Pos in Laser*2            52159\nSSP    Sample Spacing Divisor                  1\nASG    Actual Signal Gain                      1\nARG    Actual Reference Gain                   1\nASS    Number of Sample Scans                  50\nGFW    Number of Good Forward Scans            25\nGBW    Number of Good Backward Scans           25\nBFW    Number of Bad Forward Scans             0\nBBW    Number of Bad Backward Scans            0\nPKA    Peak Amplitude                          1409\nPKL    Peak Location                           7364\nPRA    Backward Peak Amplitude                 1356\nPRL    Backward Peak Location                  7363\nP2A    Peak Amplitude Channel 2                1\nP2L    Peak Location Channel 2                 1\nP2R    Backward Peak Amplitude Channel 2       1\nP2K    Backward Peak Location Channel 2        1\nDAQ    Data Acquisition Status                 0\nAG2    Actual Signal Gain Channel 2            1\nHUM    Relative Humidity Interferometer        14\nSSM    Sample Spacing Multiplier               1\nRSN    Running Sample Number                   565\nCRR    Correlation Rejection Reason            0\nSRT    Start Time (sec)                        1556890484.642\nDUR    Duration (sec)                          42.433990478515625\nTSC    Scanner Temperature                     27.8\nMVD    Max Velocity Deviation                  0.1158025860786438\nPRS    Pressure Interferometer (hPa)           1009.9999700000001\nAN1    Analog Signal 1                         0.22596596493037535\nAN2    Analog Signal 2                         3.459206583321489\nVSN    Firmware Version                        2.450 Oct 10 2014\nSRN    Instrument Serial Number                1135\nCAM    Coaddition Mode                         0\nINS    Instrument Type                         VERTEX 80V\nFOC    Focal Length                            100.0\nRDY    Ready Check                             1\n\n====================================================================================================\n                               Reference Instrument Status Parameters\nKey    Label                                   Value\nHFL    High Folding Limit                      15795.820598\nLFL    Low Folding Limit                       0.0\nLWN    Laser Wavenumber                        15795.820598\nABP    Absolute Peak Pos in Laser*2            52159\nSSP    Sample Spacing Divisor                  1\nARG    Actual Reference Gain                   1\nASG    Actual Signal Gain                      1\nASS    Number of Sample Scans                  1\nGFW    Number of Good Forward Scans            1\nGBW    Number of Good Backward Scans           0\nBFW    Number of Bad Forward Scans             0\nBBW    Number of Bad Backward Scans            0\nPKA    Peak Amplitude                          1644\nPKL    Peak Location                           7364\nPRA    Backward Peak Amplitude                 1\nPRL    Backward Peak Location                  -1\nP2A    Peak Amplitude Channel 2                1\nP2L    Peak Location Channel 2                 1\nP2R    Backward Peak Amplitude Channel 2       1\nP2K    Backward Peak Location Channel 2        1\nDAQ    Data Acquisition Status                 0\nAG2    Actual Signal Gain Channel 2            1\nHUM    Relative Humidity Interferometer        0\nSSM    Sample Spacing Multiplier               1\nRSN    Running Sample Number                   5816\nCRR    Correlation Rejection Reason            0\nSRT    Start Time (sec)                        1556890282.358\nDUR    Duration (sec)                          0.7919998168945312\nTSC    Scanner Temperature                     27.8\nMVD    Max Velocity Deviation                  0.10553144663572311\nPRS    Pressure Interferometer (hPa)           2.01999\nAN1    Analog Signal 1                         0.22577181458473206\nAN2    Analog Signal 2                         4.0960001945495605\nVSN    Firmware Version                        2.450 Oct 10 2014\nSRN    Instrument Serial Number                1135\nCAM    Coaddition Mode                         0\nINS    Instrument Type                         VERTEX 80V\nFOC    Focal Length                            100.0\nRDY    Ready Check                             1\nARS    Number of Reference Scans               1\n\n====================================================================================================\n                                    Reference Optical Parameters\nKey    Label                                   Value\nACC    Accessory                               TRANS *010A984F\nAPR    ATR Pressure                            0\nAPT    Aperture Setting                        1 mm\nBMS    Beamsplitter                            KBr-Broadband\nDTC    Detector                                RT-DLaTGS [Internal Pos.1]\nHPF    High Pass Filter                        0\nLPF    Low Pass Filter                         10.0\nLPV    Variable Low Pass Filter (cm-1)         4000\nOPF    Optical Filter Setting                  Open\nPGR    Reference Preamplifier Gain             3\nRCH    Reference Measurement Channel           Sample Compartment\nRDX    Extended Ready Check                    0\nSRC    Source                                  MIR\nVEL    Scanner Velocity                        10.0\nADC    External Analog Signals                 0\nSON    External Sync                           Off\n\n====================================================================================================\n                                  Reference Acquisition Parameters\nKey    Label                                   Value\nADT    Additional Data Treatment               0\nAQM    Acquisition Mode                        DD\nCFE    Low Intensity Power Mode with DTGS      0\nCOR    Correlation Test Mode                   0\nDEL    Delay Before Measurement                0\nDLY    Stabilization Delay                     0\nHFW    Wanted High Freq Limit                  15000.0\nLFW    Wanted Low Freq Limit                   0.0\nNSR    Number of Background Scans              1\nPLF    Result Spectrum Type                    TR\nRES    Resolution (cm-1)                       4.0\nRGN    Reference Signal Gain                   1\nSTR    Scans or Time (Reference)               0\nTCL    Command Line for Additional Data Tr...\nTDL    To Do List                              16777271\n\n====================================================================================================\n                               Reference Fourier Transform Parameters\nKey    Label                                   Value\nAPF    Apodization Function                    B3\nHFQ    End Frequency Limit for File            500.0\nLFQ    Start Frequency Limit for File          10000.0\nNLI    Nonlinearity Correction                 0\nPHR    Phase Resolution                        100.0\nPHZ    Phase Correction Mode                   ML\nSPZ    Stored Phase Mode                       NO\nZFF    Zero Filling Factor                     2\n
    \n
    \n\n

    \n\n

    \n\n

    You can access a specific parameter simply by calling the key as a direct attribute of the class (case insensitive). You\ncan also get the human-readable label using the get_param_label function:

    \n\n
    \n
    from brukeropus.file import get_param_label\ndata = read_opus('file.0')\nprint(get_param_label('bms') + ':', data.bms)\nprint(get_param_label('src') + ':', data.src)\n
    \n
    \n\n
    \n
    Beamsplitter: KBr-Broadband\nSource: MIR\n
    \n
    \n\n

    You will notice in the example output that some keys (e.g. zero filling factor zff) may have two entries: one for the\nsample measurement and another for the reference. By default, the sample parameters are accessible directly from the\nOPUSFile class, while the reference parameters can be accessed through the rf_params attribute.

    \n\n
    \n
    data = read_opus('file.0')\nprint('Sample ZFF:', data.zff, 'Reference ZFF:', data.rf_params.zff)\n
    \n
    \n\n
    \n
    Sample ZFF: 2 Reference ZFF: 2\n
    \n
    \n\n

    You can also iterate over the parameters using the familiar keys(), values(), and items() functions using the\nparams or rf_params attributes:

    \n\n
    \n
    data = read_opus('file.0')\nfor key, val in data.params.items():\n    print(key + ':', val)\n
    \n
    \n\n
    \n
    acc: TRANS *010A984F\napr: 0\napt: 1 mm\nbms: KBr-Broadband\nchn: Sample Compartment\ndtc: RT-DLaTGS [Internal Pos.1]\nhpf: 0\nlpf: 10.0\nlpv: 4000\nopf: Open\npgn: 3\n... continued ...\n
    \n
    \n\n

    Depending on the settings used to save the OPUS file, different data blocks can be stored. To retrieve a list of data\nblocks stored in the OPUS File, use the data_keys attribute:

    \n\n
    \n
    data = read_opus('file.0')\nprint(data.data_keys)\n
    \n
    \n\n
    \n
    ['igsm', 'phsm', 'sm', 'a', 'igrf', 'rf']\n
    \n
    \n\n

    Each key is also an attribute of the OPUSFile instance that returns either a Data or Data3D class. You can get\nthe x and y array values (in the units they were saved in) as direct attributes to the Data class:

    \n\n
    \n
    data = read_opus('file.0')\nplt.plot(data.a.x, data.a.y)\nplt.ylim((0, 1))\nplt.show()\n
    \n
    \n\n

    For spectra with wavenumber as valid unit (e.g. single-channel or ratioed spectra), the x array can be given in cm\u207b\u00b9\nor \u00b5m units by using the attributes wn or wl respectively:

    \n\n
    \n
    data = read_opus('file.0')\nplt.plot(data.sm.wl, data.sm.y)\nplt.show()\n
    \n
    \n\n

    You can also iterate over all data spectra in the file using the iter_data() method:

    \n\n
    \n
    data = read_opus('file.0')\nfor d in data.iter_data():\n    print(d.label, '(' + d.datetime.isoformat(' ') + ')')\n
    \n
    \n\n
    \n
    Sample Interferogram (2019-05-03 13:34:44.641000)\nSample Phase (2019-05-03 13:34:44.641000)\nSample Spectrum (2019-05-03 13:34:44.641000)\nAbsorbance (2019-05-03 13:34:44.641000)\nReference Interferogram (2019-05-03 13:31:22.358000)\nReference Spectrum (2019-05-03 13:31:22.358000)\n
    \n
    \n\n

    Each data block in an OPUS file also contains a small parameter block with information such as the min/max y-value\n(mny, mxy), x-units (dxu), number of data points (npt), etc. These can be accessed as direct attributes to the Data\nclass, or through the params attribute:

    \n\n
    \n
    data = read_opus('file.0')\nprint('Sample spectra y-min:', data.sm.mny, 'y-max:', data.sm.mxy)\n
    \n
    \n\n
    \n
    Sample spectra y-min: 1.2147593224653974e-05 y-max: 0.03543896973133087\n
    \n
    \n\n

    For full API documentation, see:
    \nOPUSFile: brukeropus.file.file.OPUSFile
    \nData: brukeropus.file.file.Data
    \nData3D: brukeropus.file.file.Data3D

    \n"}, {"fullname": "brukeropus.file.constants", "modulename": "brukeropus.file.constants", "kind": "module", "doc": "

    \n"}, {"fullname": "brukeropus.file.constants.PARAM_LABELS", "modulename": "brukeropus.file.constants", "qualname": "PARAM_LABELS", "kind": "variable", "doc": "

    \n", "default_value": "{'ACC': 'Accessory', 'ABP': 'Absolute Peak Pos in Laser*2', 'ADC': 'External Analog Signals', 'ADT': 'Additional Data Treatment', 'AG2': 'Actual Signal Gain Channel 2', 'AN1': 'Analog Signal 1', 'AN2': 'Analog Signal 2', 'APF': 'Apodization Function', 'APR': 'ATR Pressure', 'APT': 'Aperture Setting', 'AQM': 'Acquisition Mode', 'ARG': 'Actual Reference Gain', 'ARS': 'Number of Reference Scans', 'ASG': 'Actual Signal Gain', 'ASS': 'Number of Sample Scans', 'BBW': 'Number of Bad Backward Scans', 'BFW': 'Number of Bad Forward Scans', 'BLD': 'Building', 'BMS': 'Beamsplitter', 'CAM': 'Coaddition Mode', 'CFE': 'Low Intensity Power Mode with DTGS', 'CHN': 'Measurement Channel', 'CNM': 'Operator Name', 'COR': 'Correlation Test Mode', 'CPG': 'Character Encoding Code Page', 'CPY': 'Company', 'CRR': 'Correlation Rejection Reason', 'CSF': 'Y Scaling Factor', 'DAQ': 'Data Acquisition Status', 'DAT': 'Date of Measurement', 'DEL': 'Delay Before Measurement', 'DLY': 'Stabilization Delay', 'DPF': 'Data Point Format', 'DPM': 'Department', 'DTC': 'Detector', 'DUR': 'Duration (sec)', 'DXU': 'X Units', 'DYU': 'Y Units', 'EXP': 'Experiment', 'FOC': 'Focal Length', 'FXV': 'First X Value', 'GBW': 'Number of Good Backward Scans', 'GFW': 'Number of Good Forward Scans', 'HFF': 'Digital Filter High Folding Limit', 'HFL': 'High Folding Limit', 'HFQ': 'End Frequency Limit for File', 'HFW': 'Wanted High Freq Limit', 'HPF': 'High Pass Filter', 'HUM': 'Relative Humidity Interferometer', 'INS': 'Instrument Type', 'IST': 'Instrument Status', 'LCT': 'Location', 'LFF': 'Digital Filter Low Folding Limit', 'LFL': 'Low Folding Limit', 'LFQ': 'Start Frequency Limit for File', 'LFW': 'Wanted Low Freq Limit', 'LPF': 'Low Pass Filter', 'LPV': 'Variable Low Pass Filter (cm-1)', 'LWN': 'Laser Wavenumber', 'LXV': 'Last X Value', 'MNY': 'Y Minimum', 'MVD': 'Max Velocity Deviation', 'MXY': 'Y Maximum', 'NFL': 'Nominal FW Peak Pos in Points', 'NLA': 'NL Alpha', 'NLB': 'NL Beta', 'NLI': 'Nonlinearity Correction', 'NPT': 'Number of Data Points', 'NSN': 'Scan Number', 'NSR': 'Number of Background Scans', 'NSS': 'Number of Sample Scans', 'OPF': 'Optical Filter Setting', 'P2A': 'Peak Amplitude Channel 2', 'P2K': 'Backward Peak Location Channel 2', 'P2L': 'Peak Location Channel 2', 'P2R': 'Backward Peak Amplitude Channel 2', 'PGN': 'Preamplifier Gain', 'PGR': 'Reference Preamplifier Gain', 'PHR': 'Phase Resolution', 'PHZ': 'Phase Correction Mode', 'PKA': 'Peak Amplitude', 'PKL': 'Peak Location', 'PLF': 'Result Spectrum Type', 'PRA': 'Backward Peak Amplitude', 'PRL': 'Backward Peak Location', 'PRS': 'Pressure Interferometer (hPa)', 'RCH': 'Reference Measurement Channel', 'RDX': 'Extended Ready Check', 'RDY': 'Ready Check', 'RES': 'Resolution (cm-1)', 'RG2': 'Signal Gain, Background 2nd Channel', 'RGN': 'Reference Signal Gain', 'RSN': 'Running Sample Number', 'SFM': 'Sample Form', 'SG2': 'Signal Gain, Sample 2nd Channel', 'SGN': 'Sample Signal Gain', 'SNM': 'Sample Name', 'SON': 'External Sync', 'SOT': 'Sample Scans or Time', 'SPO': 'Sample Number', 'SPZ': 'Stored Phase Mode', 'SRC': 'Source', 'SRN': 'Instrument Serial Number', 'SRT': 'Start Time (sec)', 'SSM': 'Sample Spacing Multiplier', 'SSP': 'Sample Spacing Divisor', 'STR': 'Scans or Time (Reference)', 'TCL': 'Command Line for Additional Data Treatment', 'TDL': 'To Do List', 'TIM': 'Time of Measurement', 'TPX': 'Total Points X', 'TSC': 'Scanner Temperature', 'UID': 'Universally Unique Identifier', 'VEL': 'Scanner Velocity', 'VSN': 'Firmware Version', 'WAS': 'Tr.Rec. Slices', 'WDV': 'Transient Recorder', 'WIB': 'Tr.Rec.Input Range 2nd channel', 'WIR': 'Tr.Rec.Input Range', 'WPD': 'Tr.Rec. Stab. Delay after Stepping', 'WRC': 'Tr.Rec. Repeat Count', 'WSS': 'Tr.Rec. Sampling Source', 'WTD': 'Tr.Rec. trigger Delay in points', 'WTR': 'Tr.Rec. Resolution', 'WXD': 'Tr.Rec. Experiment Delay', 'WXP': 'Tr.Rec. Trigger Mode', 'XPP': 'Experiment Path', 'XSM': 'Xs Sampling Mode', 'ZFF': 'Zero Filling Factor'}"}, {"fullname": "brukeropus.file.constants.CODE_0", "modulename": "brukeropus.file.constants", "qualname": "CODE_0", "kind": "variable", "doc": "

    \n", "default_value": "{0: '', 1: 'Real Part of Complex Data', 2: 'Imaginary Part of Complex Data', 3: ''}"}, {"fullname": "brukeropus.file.constants.CODE_1", "modulename": "brukeropus.file.constants", "qualname": "CODE_1", "kind": "variable", "doc": "

    \n", "default_value": "{0: '', 1: 'Sample', 2: 'Reference', 3: ''}"}, {"fullname": "brukeropus.file.constants.CODE_2", "modulename": "brukeropus.file.constants", "qualname": "CODE_2", "kind": "variable", "doc": "

    \n", "default_value": "{0: '', 1: 'Data Status Parameters', 2: 'Instrument Status Parameters', 3: 'Acquisition Parameters', 4: 'Fourier Transform Parameters', 5: 'Plot and Display Parameters', 6: 'Optical Parameters', 7: 'GC Parameters', 8: 'Library Search Parameters', 9: 'Communication Parameters', 10: 'Sample Origin Parameters'}"}, {"fullname": "brukeropus.file.constants.CODE_3", "modulename": "brukeropus.file.constants", "qualname": "CODE_3", "kind": "variable", "doc": "

    \n", "default_value": "{0: '', 1: 'Spectrum', 2: 'Interferogram', 3: 'Phase', 4: 'Absorbance', 5: 'Transmittance', 6: 'Kubelka-Munk', 7: 'Trace (Intensity over time)', 8: 'gc File, Series of Interferograms', 9: 'gc File, Series of Spectra', 10: 'Raman', 11: 'Emisson', 12: 'Reflectance', 13: 'Directory', 14: 'Power', 15: 'log Reflectance', 16: 'ATR', 17: 'Photoacoustic', 18: 'Result of Arithmatics, looks like Transmittance', 19: 'Result of Arithmatics, looks like Absorbance'}"}, {"fullname": "brukeropus.file.constants.CODE_4", "modulename": "brukeropus.file.constants", "qualname": "CODE_4", "kind": "variable", "doc": "

    \n", "default_value": "{0: '', 1: 'First Derivative', 2: 'Second Derivative', 3: 'n-th Derivative'}"}, {"fullname": "brukeropus.file.constants.CODE_5", "modulename": "brukeropus.file.constants", "qualname": "CODE_5", "kind": "variable", "doc": "

    \n", "default_value": "{0: '', 1: 'Compound Information', 2: 'Peak Table', 3: 'Molecular Structure', 4: 'Macro', 5: 'File Log'}"}, {"fullname": "brukeropus.file.constants.CODE_3_ABR", "modulename": "brukeropus.file.constants", "qualname": "CODE_3_ABR", "kind": "variable", "doc": "

    \n", "default_value": "{0: '', 1: '', 2: 'ig', 3: 'ph', 4: 'a', 5: 't', 6: 'km', 7: 'tr', 8: 'gcig', 9: 'gcsc', 10: 'ra', 11: 'e', 12: 'r', 13: 'dir', 14: 'p', 15: 'logr', 16: 'atr', 17: 'pas', 18: 'arit', 19: 'aria'}"}, {"fullname": "brukeropus.file.constants.TYPE_CODE_LABELS", "modulename": "brukeropus.file.constants", "qualname": "TYPE_CODE_LABELS", "kind": "variable", "doc": "

    \n", "default_value": "[{0: '', 1: 'Real Part of Complex Data', 2: 'Imaginary Part of Complex Data', 3: ''}, {0: '', 1: 'Sample', 2: 'Reference', 3: ''}, {0: '', 1: 'Data Status Parameters', 2: 'Instrument Status Parameters', 3: 'Acquisition Parameters', 4: 'Fourier Transform Parameters', 5: 'Plot and Display Parameters', 6: 'Optical Parameters', 7: 'GC Parameters', 8: 'Library Search Parameters', 9: 'Communication Parameters', 10: 'Sample Origin Parameters'}, {0: '', 1: 'Spectrum', 2: 'Interferogram', 3: 'Phase', 4: 'Absorbance', 5: 'Transmittance', 6: 'Kubelka-Munk', 7: 'Trace (Intensity over time)', 8: 'gc File, Series of Interferograms', 9: 'gc File, Series of Spectra', 10: 'Raman', 11: 'Emisson', 12: 'Reflectance', 13: 'Directory', 14: 'Power', 15: 'log Reflectance', 16: 'ATR', 17: 'Photoacoustic', 18: 'Result of Arithmatics, looks like Transmittance', 19: 'Result of Arithmatics, looks like Absorbance'}, {0: '', 1: 'First Derivative', 2: 'Second Derivative', 3: 'n-th Derivative'}, {0: '', 1: 'Compound Information', 2: 'Peak Table', 3: 'Molecular Structure', 4: 'Macro', 5: 'File Log'}]"}, {"fullname": "brukeropus.file.constants.STRUCT_3D_INFO_BLOCK", "modulename": "brukeropus.file.constants", "qualname": "STRUCT_3D_INFO_BLOCK", "kind": "variable", "doc": "

    \n", "default_value": "[{'key': 'nss', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'nsr', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'nsn', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'npt', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'gfw', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'gbw', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'bfw', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'bbw', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'hfl', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'lfl', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'hff', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'lff', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'filter_size', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'filter_type', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'fxv', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'lxv', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'mny', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'mxy', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'csf', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'pka', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'pra', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'pkl', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'prl', 'fmt': 'l', 'dtype': <class 'numpy.int32'>}, {'key': 'srt', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}, {'key': 'tim', 'fmt': 'd', 'dtype': <class 'numpy.float64'>}]"}, {"fullname": "brukeropus.file.constants.Y_LABELS", "modulename": "brukeropus.file.constants", "qualname": "Y_LABELS", "kind": "variable", "doc": "

    \n", "default_value": "{'sm': 'Sample Spectrum', 'rf': 'Reference Spectrum', 'igsm': 'Sample Interferogram', 'igrf': 'Reference Interferogram', 'phsm': 'Sample Phase', 'phrf': 'Reference Phase', 'a': 'Absorbance', 't': 'Transmittance', 'r': 'Reflectance', 'km': 'Kubelka-Munk', 'tr': 'Trace (Intensity over Time)', 'gcig': 'gc File (Series of Interferograms)', 'gcsc': 'gc File (Series of Spectra)', 'ra': 'Raman', 'e': 'Emission', 'dir': 'Directory', 'p': 'Power', 'logr': 'log(Reflectance)', 'atr': 'ATR', 'pas': 'Photoacoustic'}"}, {"fullname": "brukeropus.file.constants.XUN_LABELS", "modulename": "brukeropus.file.constants", "qualname": "XUN_LABELS", "kind": "variable", "doc": "

    \n", "default_value": "{'wl': 'Wavelength', 'wn': 'Wavenumber', 'f': 'Frequency', 'pnt': 'Points', 'min': 'Minutes', 'logwn': 'Log Wavenumber'}"}, {"fullname": "brukeropus.file.file", "modulename": "brukeropus.file.file", "kind": "module", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.read_opus", "modulename": "brukeropus.file.file", "qualname": "read_opus", "kind": "function", "doc": "

    Return an OPUSFile object from an OPUS file filepath.

    \n\n
    The following produces identical results:
    \n\n
    \n
    \n
    data = read_opus(filepath)\ndata = OPUSFile(filepath)\n
    \n
    \n
    \n\n
    Arguments:
    \n\n
      \n
    • filepath (str or Path): filepath of an OPUS file (typically *.0)
    • \n
    \n\n
    Returns:
    \n\n
    \n

    opus_file (OPUSFile): an instance of the OPUSFile class containing all data/metadata extracted from the\n file.

    \n
    \n", "signature": "(filepath):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.OPUSFile", "modulename": "brukeropus.file.file", "qualname": "OPUSFile", "kind": "class", "doc": "

    Class that contains the data and metadata contained in a bruker OPUS file.

    \n\n
    Arguments:
    \n\n
      \n
    • filepath: full path to the OPUS file to be parsed. Can be a string or Path object and is required to initilize\nan OPUSFile object.
    • \n
    \n\n
    Attributes:
    \n\n
      \n
    • is_opus (bool): True if filepath points to an OPUS file, False otherwise. Also returned for dunder \n__bool__()
    • \n
    • params (Parameters): class containing all general parameter metadata for the OPUS file. To save typing, the\nthree char parameters from params also become attributes of the OPUSFile class (e.g. bms, apt, src)
    • \n
    • rf_params (Parameters): class containing all reference parameter metadata for the OPUS file.
    • \n
    • data_keys (list): list of all data block keys stored in the file (i.e. sm, rf, t, a, r, igsm, igrf, phsm, etc.).\nThese keys become data attributes of the class which return an instance of Data or Data3D.
    • \n
    • datetime (datetime): Returns the most recent datetime of all the data blocks stored in the file (typically\nresult spectra)
    • \n
    • directory (FileDirectory): class containing information about all the various data blocks in the file.
    • \n
    • file_log (str): File log containing text about how the file was generated/edited (not always saved)
    • \n
    \n\n
    Data Attributes:
    \n\n
    \n

    sm: Single-channel sample spectra
    \n rf: Single-channel reference spectra
    \n igsm: Sample interferogram
    \n igrf: Reference interferogram
    \n phsm: Sample phase
    \n phrf: Reference phase
    \n a: Absorbance
    \n t: Transmittance
    \n r: Reflectance
    \n km: Kubelka-Munk
    \n tr: Trace (Intensity over Time)
    \n gcig: gc File (Series of Interferograms)
    \n gcsc: gc File (Series of Spectra)
    \n ra: Raman
    \n e: Emission
    \n dir: Directory
    \n p: Power
    \n logr: log(Reflectance)
    \n atr: ATR
    \n pas: Photoacoustic

    \n
    \n"}, {"fullname": "brukeropus.file.file.OPUSFile.__init__", "modulename": "brukeropus.file.file", "qualname": "OPUSFile.__init__", "kind": "function", "doc": "

    \n", "signature": "(filepath: str)"}, {"fullname": "brukeropus.file.file.OPUSFile.filepath", "modulename": "brukeropus.file.file", "qualname": "OPUSFile.filepath", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.OPUSFile.print_parameters", "modulename": "brukeropus.file.file", "qualname": "OPUSFile.print_parameters", "kind": "function", "doc": "

    Prints all the parameter metadata to the console (organized by block)

    \n", "signature": "(self, key_width=7, label_width=40, value_width=53):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.OPUSFile.iter_data", "modulename": "brukeropus.file.file", "qualname": "OPUSFile.iter_data", "kind": "function", "doc": "

    Generator that yields the various Data classes from the OPUSFile

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo", "kind": "class", "doc": "

    Contains type, size and location information about an OPUS file block.

    \n\n

    This information is parsed from the directory block of an OPUS file and provides the information needed to parse the\nblock.

    \n\n
    Arguments:
    \n\n
      \n
    • block_type: six integer tuple that describes the type of data in the file block
    • \n
    • size: size of block in number of bytes
    • \n
    • start: pointer to start location of the block within the file.
    • \n
    \n\n
    Attributes:
    \n\n
      \n
    • type: six integer tuple that describes the type of data in the file block
    • \n
    • size: size of block in number of bytes
    • \n
    • start: pointer to start location of the block within the file
    • \n
    • keys: tuple of three char keys contained in parameter blocks. This attribute is set by the OPUSFile class only\nwhen the block is parameter block. This enables grouping parameters by block if desired.
    • \n
    • bytes: raw bytes of file block (currently only set for unknown blocks)
    • \n
    \n"}, {"fullname": "brukeropus.file.file.FileBlockInfo.__init__", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.__init__", "kind": "function", "doc": "

    \n", "signature": "(block_type: tuple, size: int, start: int)"}, {"fullname": "brukeropus.file.file.FileBlockInfo.keys", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.keys", "kind": "variable", "doc": "

    \n", "annotation": ": tuple"}, {"fullname": "brukeropus.file.file.FileBlockInfo.type", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.type", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.FileBlockInfo.size", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.size", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.FileBlockInfo.start", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.start", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_data_status", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_data_status", "kind": "function", "doc": "

    Returns True if FileBlockInfo is a data status parameter block

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_rf_param", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_rf_param", "kind": "function", "doc": "

    Returns True if FileBlockInfo is a parameter block associated with the reference measurement

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_param", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_param", "kind": "function", "doc": "

    Returns True if FileBlockInfo is a parameter block

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_directory", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_directory", "kind": "function", "doc": "

    Returns True if FileBlockInfo is the directory block

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_file_log", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_file_log", "kind": "function", "doc": "

    Returns True if FileBlockInfo is the file log block

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_data", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_data", "kind": "function", "doc": "

    Returns True if FileBlockInfo is a data block or 3D data block

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_3d_data", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_3d_data", "kind": "function", "doc": "

    Returns True if FileBlockInfo is a 3D data block (i.e. data series)

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.is_data_status_match", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.is_data_status_match", "kind": "function", "doc": "

    Returns True if FileBlockInfo is a data status block and a match to the data_block_info argument.

    \n\n

    This function is used to match a data status block (contains metadata for data block) with its associated data\nblock (contains array data).

    \n\n
    Arguments:
    \n\n
      \n
    • data_block_info (FileBlockInfo): data block being tested as a match.
    • \n
    \n\n
    Returns:
    \n\n
    \n

    is_match (bool): True if FileBlockInfo is data status block and input argument is matching data block

    \n
    \n", "signature": "(self, data_block_info):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.get_label", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.get_label", "kind": "function", "doc": "

    Returns a friendly string label that describes the block type

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.get_data_key", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.get_data_key", "kind": "function", "doc": "

    If block is a data block, this function will return an shorthand key to reference that data.

    \n\n

    e.g. t: transmission, a: absorption, sm: sample, rf: reference, smph: sample phase etc. If the block is not\na data block, it will return None.

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.FileBlockInfo.bytes", "modulename": "brukeropus.file.file", "qualname": "FileBlockInfo.bytes", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data", "modulename": "brukeropus.file.file", "qualname": "Data", "kind": "class", "doc": "

    Class containing array data and associated parameter/metadata from an OPUS file.

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: raw bytes from OPUS file. see: read_opus_file_bytes
    • \n
    • data_info: FileBlockInfo instance of a data block
    • \n
    • data_status_info: FileBlockInfo instance of a data status block which contains metadata about the data_info\nblock. This block is a parameter block.
    • \n
    \n\n
    Attributes:
    \n\n
      \n
    • params: Parameter class with metadata associated with the data block such as first x point: fxp, last x\npoint: lxp, number of points: npt, date: dat, time: tim etc.
    • \n
    • y: 1D numpy array containing y values of data block
    • \n
    • x: 1D numpy array containing x values of data block. Units of x array are given by dxu parameter.
    • \n
    • label: human-readable string label describing the data block (e.g. Sample Spectrum, Absorbance, etc.)
    • \n
    \n\n
    Extended Attributes:
    \n\n
    \n

    wn: Returns the x array in wavenumber (cm\u207b\u00b9) units regardless of what units the x array was originally\n saved in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not\n interferogram or phase blocks.
    \n wl: Returns the x array in wavelength (\u00b5m) units regardless of what units the x array was originally\n saved in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not\n interferogram or phase blocks.
    \n f: Returns the x array in modulation frequency units (Hz) regardless of what units the x array was\n originally saved in. This is only valid for spectral data blocks such as sample, reference, transmission,\n etc., not interferogram or phase blocks.
    \n datetime: Returns a datetime class of when the data was taken (extracted from data status parameter block).
    \n xxx: the various three char parameter keys from the params attribute can be directly called from the \n Data class for convenience. Common parameters include dxu (x units), mxy (max y value), mny (min y\n value), etc.

    \n
    \n"}, {"fullname": "brukeropus.file.file.Data.__init__", "modulename": "brukeropus.file.file", "qualname": "Data.__init__", "kind": "function", "doc": "

    \n", "signature": "(\tfilebytes: bytes,\tdata_info: brukeropus.file.file.FileBlockInfo,\tdata_status_info: brukeropus.file.file.FileBlockInfo)"}, {"fullname": "brukeropus.file.file.Data.params", "modulename": "brukeropus.file.file", "qualname": "Data.params", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data.y", "modulename": "brukeropus.file.file", "qualname": "Data.y", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data.x", "modulename": "brukeropus.file.file", "qualname": "Data.x", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data.label", "modulename": "brukeropus.file.file", "qualname": "Data.label", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data.vel", "modulename": "brukeropus.file.file", "qualname": "Data.vel", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data3D", "modulename": "brukeropus.file.file", "qualname": "Data3D", "kind": "class", "doc": "

    Class containing 3D array data (series of spectra) and associated parameter/metadata from an OPUS file.

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: raw bytes from OPUS file. see: read_opus_file_bytes
    • \n
    • data_info: FileBlockInfo instance of a 3D data block
    • \n
    • data_status_info: FileBlockInfo instance of a data status block which contains metadata about the data_info\nblock. This block is a parameter block.
    • \n
    \n\n
    Attributes:
    \n\n
      \n
    • params: Parameter class with metadata associated with the data block such as first x point (fxp), last x point\n(lxp), number of points (npt), date (dat), time (tim) etc.
    • \n
    • y: 2D numpy array containing y values of data block
    • \n
    • x: 1D numpy array containing x values of data block. Units of x array are given by .dxu attribute.
    • \n
    • num_spectra: number of spectra in the series (i.e. length of y)
    • \n
    • label: human-readable string label describing the data block (e.g. Sample Spectrum, Absorbance, etc.)
    • \n
    \n\n
    Extended Attributes:
    \n\n
    \n

    wn: Returns the x array in wavenumber (cm\u207b\u00b9) units regardless of what units the x array was originally saved\n in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not\n interferogram or phase blocks.
    \n wl: Returns the x array in wavelength (\u00b5m) units regardless of what units the x array was originally saved\n in. This is only valid for spectral data blocks such as sample, reference, transmission, etc., not\n interferogram or phase blocks.
    \n datetime: Returns a datetime class of when the data was taken (extracted from data status parameter\n block).
    \n xxx: the various three char parameter keys from the \"params\" attribute can be directly called from the data\n class for convenience. Several of these parameters return arrays, rather than singular values because they\n are recorded for every spectra in the series, e.g. npt, mny, mxy, tim, nsn.

    \n
    \n", "bases": "Data"}, {"fullname": "brukeropus.file.file.Data3D.__init__", "modulename": "brukeropus.file.file", "qualname": "Data3D.__init__", "kind": "function", "doc": "

    \n", "signature": "(\tfilebytes: bytes,\tdata_info: brukeropus.file.file.FileBlockInfo,\tdata_status_info: brukeropus.file.file.FileBlockInfo)"}, {"fullname": "brukeropus.file.file.Data3D.params", "modulename": "brukeropus.file.file", "qualname": "Data3D.params", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data3D.y", "modulename": "brukeropus.file.file", "qualname": "Data3D.y", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data3D.x", "modulename": "brukeropus.file.file", "qualname": "Data3D.x", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data3D.num_spectra", "modulename": "brukeropus.file.file", "qualname": "Data3D.num_spectra", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Data3D.label", "modulename": "brukeropus.file.file", "qualname": "Data3D.label", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.Parameters", "modulename": "brukeropus.file.file", "qualname": "Parameters", "kind": "class", "doc": "

    Class containing parameter metadata of an OPUS file.

    \n\n

    Parameters of an OPUS file are stored as key, val pairs, where the key is always three chars. For example, the\nbeamsplitter is stored in the \"bms\" attribute, source in \"src\" etc. A list of known keys, with friendly label can\nbe found in brukeropus.file.constants.PARAM_LABELS. The keys in an OPUS file are not case sensitive, and stored\nin all CAPS (i.e. BMS, SRC, etc.) but this class uses lower case keys to follow python convention. The class is\ninitialized from a list of parameter FileBlockInfo. The key, val items in blocks of the list are combined into\none parameter class, so care must be taken not to pass blocks that will overwrite each others keys. Analagous to a\ndict, the keys, values, and (key, val) can be iterated over using the functions: keys(), values(), and items()\nrespectively.

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: raw bytes from OPUS file. see: brukeropus.file.parser.read_opus_file_bytes
    • \n
    • param_blocks: list of FileBlockInfo; every block in the list should be classified as a parameter block.
    • \n
    \n\n
    Attributes:
    \n\n
      \n
    • xxx: parameter attributes are stored as three char keys. Which keys are generated depends on the list of\nFileBlockInfo that is used to initialize the class. If input list contains a single data status\nFileBlockInfo, attributes will include: fxv, lxv, npt (first x-val, last x-val, number of points),\netc. Other blocks produce attributes such as: bms, src, apt (beamsplitter, source, aperture) etc. A\nfull list of keys available in a given Parameters instance are given by the keys() method.
    • \n
    • datetime: if blocks contain the keys: dat (date) and tim (time), the datetime attribute of this class will\nbe set to a python datetime object. Currently, only data status blocks are known to have these keys. If\ndat and tim are not present in the class, the datetime attribute will return None.
    • \n
    \n"}, {"fullname": "brukeropus.file.file.Parameters.__init__", "modulename": "brukeropus.file.file", "qualname": "Parameters.__init__", "kind": "function", "doc": "

    \n", "signature": "(filebytes: bytes, param_blocks: list)"}, {"fullname": "brukeropus.file.file.Parameters.keys", "modulename": "brukeropus.file.file", "qualname": "Parameters.keys", "kind": "function", "doc": "

    Returns a dict_keys class of all valid keys in the class (i.e. dict.keys())

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.Parameters.values", "modulename": "brukeropus.file.file", "qualname": "Parameters.values", "kind": "function", "doc": "

    Returns a dict_values class of all the values in the class (i.e. dict.values())

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.Parameters.items", "modulename": "brukeropus.file.file", "qualname": "Parameters.items", "kind": "function", "doc": "

    Returns a dict_items class of all the values in the class (i.e. dict.items())

    \n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.Parameters.datetime", "modulename": "brukeropus.file.file", "qualname": "Parameters.datetime", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.FileDirectory", "modulename": "brukeropus.file.file", "qualname": "FileDirectory", "kind": "class", "doc": "

    Contains type and pointer information for all blocks of data in an OPUS file.

    \n\n

    FileDirectory information is decoded from the raw file bytes of an OPUS file. First the header is read which\nprovides the start location of the directory block, number of blocks in file, and maximum number of blocks the file\nsupports. Then it decodes the block pointer information from each entry of the file's directory block. Rather than\nstore all file blocks in a single list (as it is done in the OPUS file directory), this class sorts the blocks into\ncategories: data, data_status, params, rf_params, directory, and file_log. It also pairs the data\nblocks with their corresponding data_status block to simplify grouping y data with the parameters that are used to\ngenerate x data and other data block specific metadata.

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: raw bytes from OPUS file. see: brukeropus.file.parser.read_opus_file_bytes
    • \n
    \n\n
    Attributes:
    \n\n
      \n
    • start: pointer to start location of the directory block
    • \n
    • max_blocks: maximum number of blocks supported by file
    • \n
    • num_blocks: total number of blocks in the file
    • \n
    • data_blocks: list of FileBlockInfo that contain array data (e.g. sample, reference, phase)
    • \n
    • data_status_blocks: list of FileBlockInfo that contain metadata specific to a data block (units, etc.)
    • \n
    • param_blocks: list of FileBlockInfo that contain metadata about the measurement sample
    • \n
    • rf_param_blocks: list of FileBlockInfo that contain metatdata about the reference measurement
    • \n
    • directory_block: FileBlockInfo for directory block that contains all the block info in the file
    • \n
    • file_log_block: FileBlockInfo of the file log (changes, etc.)
    • \n
    • data_and_status_block_pairs: (data: FileBlockInfo, data_status: FileBlockInfo) which pairs the data status\nparameter block (time, x units, y units, etc.) with the data block it informs
    • \n
    • unknown_blocks: list of FileBlockInfo with an unrecognized type (i.e. not sure how to parse)
    • \n
    \n"}, {"fullname": "brukeropus.file.file.FileDirectory.__init__", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.__init__", "kind": "function", "doc": "

    \n", "signature": "(filebytes: bytes)"}, {"fullname": "brukeropus.file.file.FileDirectory.data_blocks", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.data_blocks", "kind": "variable", "doc": "

    \n", "annotation": ": list"}, {"fullname": "brukeropus.file.file.FileDirectory.data_status_blocks", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.data_status_blocks", "kind": "variable", "doc": "

    \n", "annotation": ": list"}, {"fullname": "brukeropus.file.file.FileDirectory.param_blocks", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.param_blocks", "kind": "variable", "doc": "

    \n", "annotation": ": list"}, {"fullname": "brukeropus.file.file.FileDirectory.rf_param_blocks", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.rf_param_blocks", "kind": "variable", "doc": "

    \n", "annotation": ": list"}, {"fullname": "brukeropus.file.file.FileDirectory.directory_block", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.directory_block", "kind": "variable", "doc": "

    \n", "annotation": ": brukeropus.file.file.FileBlockInfo"}, {"fullname": "brukeropus.file.file.FileDirectory.file_log_block", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.file_log_block", "kind": "variable", "doc": "

    \n", "annotation": ": brukeropus.file.file.FileBlockInfo"}, {"fullname": "brukeropus.file.file.FileDirectory.unknown_blocks", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.unknown_blocks", "kind": "variable", "doc": "

    \n", "annotation": ": list"}, {"fullname": "brukeropus.file.file.FileDirectory.data_and_status_block_pairs", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.data_and_status_block_pairs", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.FileDirectory.max_blocks", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.max_blocks", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.FileDirectory.num_blocks", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.num_blocks", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.FileDirectory.start", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.start", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.file.FileDirectory.version", "modulename": "brukeropus.file.file", "qualname": "FileDirectory.version", "kind": "variable", "doc": "

    \n"}, {"fullname": "brukeropus.file.parser", "modulename": "brukeropus.file.parser", "kind": "module", "doc": "

    \n"}, {"fullname": "brukeropus.file.parser.read_opus_file_bytes", "modulename": "brukeropus.file.parser", "qualname": "read_opus_file_bytes", "kind": "function", "doc": "

    Returns bytes of an OPUS file specified by filepath (or None).

    \n\n

    Function determines if filepath points to an OPUS file by reading the first four bytes which are always the same\nfor OPUS files. If filepath is not a file, or points to a non-OPUS file, the function returns None. Otherwise\nthe function returns the entire file as raw bytes.

    \n\n
    Arguments:
    \n\n
      \n
    • filepath (str or Path): full filepath to OPUS file
    • \n
    \n\n
    Returns:
    \n\n
    \n

    filebytes (bytes): raw bytes of OPUS file or None (if filepath does not point to an OPUS file)

    \n
    \n", "signature": "(filepath):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.get_block_type", "modulename": "brukeropus.file.parser", "qualname": "get_block_type", "kind": "function", "doc": "

    Converts an int32 block type code to a six-integer tuple block_type.

    \n\n

    This function is used to decode the type_int from the directory block of an OPUS file into a tuple of integers.\nEach integer in the tuple provides information about the associated data block.

    \n\n
    Arguments:
    \n\n
      \n
    • type_int: 32-bit integer decoded from file directory block
    • \n
    \n\n
    Returns:
    \n\n
    \n

    block_type (tuple): six-integer tuple which specifies the block type

    \n
    \n", "signature": "(type_int: int):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.parse_header", "modulename": "brukeropus.file.parser", "qualname": "parse_header", "kind": "function", "doc": "

    Parses the OPUS file header.

    \n\n

    The header of an OPUS file contains some basic information about the file including the version number, location of\nthe directory block, and number of blocks in the file. This header is first to be parsed as it specifies how to\nread the file directory block (which contains information about each block in the file)

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: raw bytes of OPUS file (all bytes)
    • \n
    \n\n
    Returns:
    \n\n
    \n

    header_info (tuple):
    \n (
    \n version (float64): program version number as a floating-point date (later versions always greater)
    \n directory_start (int32): pointer to start location of directory block (number of bytes)
    \n max_blocks (int32): maximum number of blocks supported by the directory block (this should only be\n relevant when trying to edit an OPUS file, i.e. when adding data blocks to a file)
    \n num_blocks (int32): total number of blocks in the opus file
    \n )

    \n
    \n", "signature": "(filebytes: bytes):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.parse_directory", "modulename": "brukeropus.file.parser", "qualname": "parse_directory", "kind": "function", "doc": "

    Parses directory block of OPUS file and yields block info for all blocks in the file as a generator.

    \n\n

    The directory block of an OPUS file contains information about every block in the file. The block information is\nstored as three int32 values: type_int, size_int, start. type_int is an integer representation of the block\ntype. The bits of this type_int have meaning and are parsed into a tuple using get_block_type. The size_int is\nthe size of the block in 32-bit words. start is the starting location of the block (in number of bytes).

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: raw bytes of OPUS file (all bytes)
    • \n
    • start: start location of the directory block (specified in file header)
    • \n
    • num_blocks: total number of blocks in the file (specified in file header)
    • \n
    \n\n
    Yields:
    \n\n
    \n

    block_info (tuple):
    \n (
    \n block_type (tuple): six-integer tuple which specifies the block type (see: get_block_type)
    \n size (int): size (number of bytes) of the block
    \n start (int): pointer to start location of the block (number of bytes)
    \n )

    \n
    \n", "signature": "(filebytes: bytes, directory_start: int, num_blocks: int):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.parse_param_block", "modulename": "brukeropus.file.parser", "qualname": "parse_param_block", "kind": "function", "doc": "

    Parses the bytes in a parameter block and yields the key, value pairs as a generator.

    \n\n

    Parameter blocks are in the form: XXX, dtype_code, size, val. XXX is a three char abbreviation of the\nparameter (key). The value of the parameter is decoded according to the dtype_code and size integers to be either:\nint, float, or string.

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: raw bytes of OPUS file (all bytes)
    • \n
    • size: total number of bytes in parameter block (specified in file directory)
    • \n
    • start: pointer to start location of parameter block (specified in file directory)
    • \n
    \n\n
    Yields:
    \n\n
    \n

    items (tuple): (key, value) pairs where key is three char string (lowercase) and value can be int, float\n or string.

    \n
    \n", "signature": "(filebytes: bytes, size: int, start: int):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.get_dpf_dtype_count", "modulename": "brukeropus.file.parser", "qualname": "get_dpf_dtype_count", "kind": "function", "doc": "

    Returns numpy dtype and array count from the data point format (dpf) and block size (in bytes).

    \n\n
    Arguments:
    \n\n
      \n
    • dpf: data point format integer stored in data status block.\ndpf = 1 -> array of float32\ndpf = 2 -> array of int32
    • \n
    • size: Block size in bytes.
    • \n
    \n\n
    Returns:
    \n\n
    \n

    dtype (numpy.dtype): numpy dtype for defining an ndarray to store the data\n count (int): length of array calculated from the block size and byte size of the dtype.

    \n
    \n", "signature": "(dpf: int, size: int):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.parse_data_block", "modulename": "brukeropus.file.parser", "qualname": "parse_data_block", "kind": "function", "doc": "

    Parses the bytes in a data block (specified by size and start pointers) and returns a numpy array.

    \n\n

    Data blocks contain no metadata, only the y-values of a data array. Data arrays include: single-channel sample,\nreference, phase, interferograms, and a variety of resultant data (transmission, absorption, etc.). Every data\nblock should have a corresponding data status parameter block which can be used to generate the x-array values for\nthe data block. The data status block also specifies the data type of the data array with the DPF parameter. It\nappears that OPUS currently exclusively stores data blocks as 32-bit floats, but has a reservation for 32-bit\nintegers when DPF = 2.

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: full OPUS file bytes
    • \n
    • size: size of data block to decode in bytes
    • \n
    • start: pointer to start location of the data block
    • \n
    • dpf: data-point-format integer stored in corresponding data status block.
    • \n
    \n\n
    Returns:
    \n\n
    \n

    y_array (numpy.ndarray): numpy array of y values contained in the data block

    \n
    \n", "signature": "(filebytes: bytes, size: int, start: int, dpf=1):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.parse_3d_data_block", "modulename": "brukeropus.file.parser", "qualname": "parse_3d_data_block", "kind": "function", "doc": "

    Parses the bytes in a 3D data block (series of spectra) and returns a data dict containing data and metadata.

    \n\n

    3D data blocks are structured differently than standard data blocks. In addition to the series of spectra, they\ninclude metadata for each of the spectrum. This function returns a dict containing all the extracted information\nfrom the data block. The series spectra is formed into a 2D array while metadata captured for each spectra is\nformed into a 1D array (length = number of spectral measurements in the series).

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: full OPUS file bytes
    • \n
    • start: pointer to start location of the data block
    • \n
    • dpf: data-point-format integer stored in corresponding data status block.
    • \n
    \n\n
    Returns:
    \n\n
    \n

    data_dict (dict): dict containing all extracted information from the data block
    \n {
    \n version: file format version number (should be 0)
    \n num_blocks: number of sub blocks; each sub block features a data spectra and associated metadata
    \n offset: offset in bytes to the first sub data block
    \n data_size: size in bytes of each sub data block
    \n info_size: size in bytes of the metadata info block immediately following the sub data block
    \n store_table: run numbers of the first and last blocks to keep track of skipped spectra
    \n y: 2D numpy array containing all spectra (C-order)
    \n metadata arrays: series of metadata arrays in 1D array format (e.g. npt, mny, mxy, tim).\n The most useful one is generally tim, which can be used as the time axis for 3D data plots.
    \n }

    \n
    \n", "signature": "(filebytes: bytes, start: int, dpf: int = 1):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.parse_file_log", "modulename": "brukeropus.file.parser", "qualname": "parse_file_log", "kind": "function", "doc": "

    Parses the file log in an OPUS file and returns a list of strings contained in the log.

    \n\n

    The file log block of an OPUS file contains some information about how the file was generated and edits that have\nbeen performed on the file. This function parses the file log as a list of strings using b'\u0000' as a seperator,\nand does not take any steps to parameterizing what is contained in the log. This log is generally not needed to\nretrieve the file data and metadata, but might be useful for inspecting the file.

    \n\n
    Arguments:
    \n\n
      \n
    • filebytes: full OPUS file bytes
    • \n
    • size: size of file log block to decode in bytes
    • \n
    • start: pointer to start location of the file log block
    • \n
    \n\n
    Returns:
    \n\n
    \n

    strings (list): list of strings found in the file log.

    \n
    \n", "signature": "(filebytes: bytes, size: int, start: int):", "funcdef": "def"}, {"fullname": "brukeropus.file.utils", "modulename": "brukeropus.file.utils", "kind": "module", "doc": "

    \n"}, {"fullname": "brukeropus.file.utils.find_opus_files", "modulename": "brukeropus.file.utils", "qualname": "find_opus_files", "kind": "function", "doc": "

    Finds all files in a directory with a strictly numeric extension (OPUS file convention).

    \n\n

    Returns a list of all files in directory that end in .# (e.g. file.0, file.1, file.1001, etc.). Setting recursive\nto true will search directory and all sub directories recursively. No attempt is made to verify the files are\nactually OPUS files (requires opening the file); the function simply looks for files that match the naming pattern.

    \n\n
    Arguments:
    \n\n
      \n
    • directory (str or Path): path indicating directory to search
    • \n
    • recursive: Set to True to recursively search sub directories as well
    • \n
    \n\n
    Returns:
    \n\n
    \n

    filepaths (list): list of filepaths that match OPUS naming convention (numeric extension)

    \n
    \n", "signature": "(directory, recursive: bool = False):", "funcdef": "def"}, {"fullname": "brukeropus.file.utils.get_param_label", "modulename": "brukeropus.file.utils", "qualname": "get_param_label", "kind": "function", "doc": "

    Returns a short but descriptive label for 3-letter parameters. For example, bms returns Beamsplitter.

    \n\n

    The 3-letter parameter input is not case sensitive. This package includes the majority of parameters that OPUS\nuses, but in the event a parameter label is not known, this function will return: \"Unknown XXX\" where XXX is the\nunknown 3-letter parameter.

    \n\n
    Arguments:
    \n\n
      \n
    • param: three letter parameter code (e.g. bms, src, npt, etc.) [not case sensitive]
    • \n
    \n\n
    Returns:
    \n\n
    \n

    label (str): Human-readable string label for the parameter.

    \n
    \n", "signature": "(param: str):", "funcdef": "def"}, {"fullname": "brukeropus.file.utils.get_type_code_label", "modulename": "brukeropus.file.utils", "qualname": "get_type_code_label", "kind": "function", "doc": "

    Returns the type code label of a file block given the position index and value of the type code.

    \n\n

    The file blocks on an OPUS file feature six-integer type codes, for example (3, 1, 1, 2, 0, 0), that categorize the\ncontents of the file block. The positional index defines the category, while the value at that index defines the\nspecific type of that category. For example, the first integer (pos_idx=0), describes the type of data in the\nblock, if applicable:

    \n\n
    0: Undefined or N/A,\n1: Real Part of Complex Data,\n2: Imaginary Part of Complex Data,\n3: Amplitude\n
    \n\n

    This package includes the majority of type codes that OPUS uses, but in the event a type code label is not known,\nthis function will return: \"Unknown 0 4\" where the first number is the position index, and the second is the\nunknown value integer.

    \n\n
    Arguments:
    \n\n
      \n
    • pos_idx: positional index of the type code (0 - 5)
    • \n
    • val: value of the type code
    • \n
    \n\n
    Returns:
    \n\n
    \n

    label (str): human-readable string label that describes the type code.

    \n
    \n", "signature": "(pos_idx: int, val: int):", "funcdef": "def"}, {"fullname": "brukeropus.file.utils.get_block_type_label", "modulename": "brukeropus.file.utils", "qualname": "get_block_type_label", "kind": "function", "doc": "

    Converts a six-integer tuple block type into a human readable label.

    \n\n
    Arguments:
    \n\n
      \n
    • block_type: six integer tuple found in the OPUS file directory that describes the block type
    • \n
    \n\n
    Returns:
    \n\n
    \n

    label (str): human-readable string label

    \n
    \n", "signature": "(block_type: tuple):", "funcdef": "def"}, {"fullname": "brukeropus.file.utils.get_data_key", "modulename": "brukeropus.file.utils", "qualname": "get_data_key", "kind": "function", "doc": "

    Returns a shorthand key for a given data block type: sm, rf, igsm, a, t, r, etc.

    \n\n

    Determines if the data block type is an interferogram, single-channel, absorption, etc. and whether it is associated\nwith the sample or reference channel and returns a shortand key-like label: sm, rf, igsm, igrf, a, t, r, etc. For\nthe full data label (e.g. Sample Spectrum, Absorbance) use: get_block_type_label.\nThis package includes the majority of type codes that OPUS uses, but in the event a type code label is not known,\nthis function will return: \"_33\" or \"sm_33\" where 33 will change to the unkown block_type integer value.

    \n\n
    Arguments:
    \n\n
      \n
    • block_type: six integer tuple found in the OPUS file directory that describes the block type
    • \n
    \n\n
    Returns:
    \n\n
    \n

    key (str): shorthand string label that can be utilized as a data key (e.g. \"sm\", \"igrf\", \"a\")

    \n
    \n", "signature": "(block_type: tuple):", "funcdef": "def"}, {"fullname": "brukeropus.file.utils.parse_file_and_print", "modulename": "brukeropus.file.utils", "qualname": "parse_file_and_print", "kind": "function", "doc": "

    Parses an OPUS file and prints the block information as it goes along to the console.

    \n\n

    This function demonstrates the basic usage and interaction of the parsing functions. It\ncan also be used to diagnose a file parsing issue if one comes up.

    \n\n
    Arguments:
    \n\n
      \n
    • filepath (str or Path): filepath to an OPUS file.
    • \n
    \n", "signature": "(filepath, width=120):", "funcdef": "def"}]; +>>>>>>> origin/master // mirrored in build-search-index.js (part 1) // Also split on html tags. this is a cheap heuristic, but good enough. diff --git a/pyproject.toml b/pyproject.toml index 0d2071f..297c131 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,11 @@ build-backend = "setuptools.build_meta" [project] name = "brukeropus" +<<<<<<< HEAD version = "1.0.3" +======= +version = "1.0.4" +>>>>>>> origin/master authors = [ { name="Josh Duran", email="josh.m.duran@gmail.com" }, ]