diff --git a/docs/brukeropus/control/dde.html b/docs/brukeropus/control/dde.html index 5bb0d15..55d1a20 100644 --- a/docs/brukeropus/control/dde.html +++ b/docs/brukeropus/control/dde.html @@ -1365,7 +1365,7 @@
421 def keys(self): -422 '''Returns a `dict_keys` class of all valid keys in the class (i.e. dict.keys())''' -423 return self._params.keys() +@@ -2138,9 +2158,9 @@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()Attributes:
425 def values(self): -426 '''Returns a `dict_values` class of all the values in the class (i.e. dict.values())''' -427 return self._params.values() +@@ -2160,9 +2180,9 @@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()Attributes:
429 def items(self): -430 '''Returns a `dict_items` class of all the values in the class (i.e. dict.items())''' -431 return self._params.items() +@@ -2194,81 +2214,81 @@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()Attributes:
434class FileDirectory: -435 '''Contains type and pointer information for all blocks of data in an OPUS file. -436 -437 `FileDirectory` information is decoded from the raw file bytes of an OPUS file. First the header is read which -438 provides the start location of the directory block, number of blocks in file, and maximum number of blocks the file -439 supports. Then it decodes the block pointer information from each entry of the file's directory block. Rather than -440 store all file blocks in a single list (as it is done in the OPUS file directory), this class sorts the blocks into -441 categories: `data`, `data_status`, `params`, `rf_params`, `directory`, and `file_log`. It also pairs the data -442 blocks with their corresponding `data_status` block to simplify grouping y data with the parameters that are used to -443 generate x data and other data block specific metadata. -444 -445 Args: -446 filebytes: raw bytes from OPUS file. see: `brukeropus.file.parser.read_opus_file_bytes` -447 -448 Attributes: -449 start: pointer to start location of the directory block -450 max_blocks: maximum number of blocks supported by file -451 num_blocks: total number of blocks in the file -452 data_blocks: list of `FileBlockInfo` that contain array data (e.g. sample, reference, phase) -453 data_status_blocks: list of `FileBlockInfo` that contain metadata specific to a data block (units, etc.) -454 param_blocks: list of `FileBlockInfo` that contain metadata about the measurement sample -455 rf_param_blocks: list of `FileBlockInfo` that contain metatdata about the reference measurement -456 directory_block: `FileBlockInfo` for directory block that contains all the block info in the file -457 file_log_block: `FileBlockInfo` of the file log (changes, etc.) -458 data_and_status_block_pairs: (data: `FileBlockInfo`, data_status: `FileBlockInfo`) which pairs the data status -459 parameter block (time, x units, y units, etc.) with the data block it informs -460 ''' -461 -462 __slots__ = ('version', 'start', 'max_blocks', 'num_blocks', 'data_blocks', 'data_status_blocks', 'param_blocks', -463 'rf_param_blocks', 'directory_block', 'file_log_block', 'data_and_status_block_pairs') -464 -465 def __init__(self, filebytes: bytes): -466 self.version, self.start, self.max_blocks, self.num_blocks = parse_header(filebytes) -467 self.data_blocks: list = [] -468 self.data_status_blocks: list = [] -469 self.param_blocks: list = [] -470 self.rf_param_blocks: list = [] -471 self.directory_block: FileBlockInfo -472 self.file_log_block: FileBlockInfo -473 for block_type, size, start in parse_directory(filebytes, self.start, self.num_blocks): -474 block = FileBlockInfo(block_type=block_type, size=size, start=start) -475 if block.is_data_status(): -476 self.data_status_blocks.append(block) -477 elif block.is_rf_param(): -478 self.rf_param_blocks.append(block) -479 elif block.is_param(): -480 self.param_blocks.append(block) -481 elif block.is_directory(): -482 self.directory_block = block -483 elif block.is_file_log(): -484 self.file_log_block = block -485 elif block.is_valid(): -486 self.data_blocks.append(block) -487 self.data_and_status_block_pairs = [] -488 self._pair_data_and_status_blocks() -489 -490 def __str__(self): -491 data_keys = [b.get_data_key() for b in self.data_blocks] -492 data_str = ', '.join(data_keys) -493 return 'File Directory: ' + str(self.num_blocks) + ' total blocks; data blocks: (' + data_str + ')' -494 -495 def _pair_data_and_status_blocks(self): -496 for data_block in self.data_blocks: -497 status_matches = [block for block in self.data_status_blocks if block.is_data_status_match(data_block)] -498 if len(status_matches) == 0: -499 text = 'Warning: No data status block match for data block: ' + str(data_block) -500 + '\n\tdata block will be ignored.' -501 warnings.warn(text) -502 elif len(status_matches) > 1: -503 text = 'Warning: Multiple data status block matches for data block: ' + str(data_block) -504 + '\n\tMatches:' + '; '.join([str(match) for match in status_matches]) -505 + '\n\tdata block will be ignored.' -506 warnings.warn(text) -507 else: -508 self.data_and_status_block_pairs.append((data_block, status_matches[0])) +@@ -2316,30 +2336,30 @@444class FileDirectory: +445 '''Contains type and pointer information for all blocks of data in an OPUS file. +446 +447 `FileDirectory` information is decoded from the raw file bytes of an OPUS file. First the header is read which +448 provides the start location of the directory block, number of blocks in file, and maximum number of blocks the file +449 supports. Then it decodes the block pointer information from each entry of the file's directory block. Rather than +450 store all file blocks in a single list (as it is done in the OPUS file directory), this class sorts the blocks into +451 categories: `data`, `data_status`, `params`, `rf_params`, `directory`, and `file_log`. It also pairs the data +452 blocks with their corresponding `data_status` block to simplify grouping y data with the parameters that are used to +453 generate x data and other data block specific metadata. +454 +455 Args: +456 filebytes: raw bytes from OPUS file. see: `brukeropus.file.parser.read_opus_file_bytes` +457 +458 Attributes: +459 start: pointer to start location of the directory block +460 max_blocks: maximum number of blocks supported by file +461 num_blocks: total number of blocks in the file +462 data_blocks: list of `FileBlockInfo` that contain array data (e.g. sample, reference, phase) +463 data_status_blocks: list of `FileBlockInfo` that contain metadata specific to a data block (units, etc.) +464 param_blocks: list of `FileBlockInfo` that contain metadata about the measurement sample +465 rf_param_blocks: list of `FileBlockInfo` that contain metatdata about the reference measurement +466 directory_block: `FileBlockInfo` for directory block that contains all the block info in the file +467 file_log_block: `FileBlockInfo` of the file log (changes, etc.) +468 data_and_status_block_pairs: (data: `FileBlockInfo`, data_status: `FileBlockInfo`) which pairs the data status +469 parameter block (time, x units, y units, etc.) with the data block it informs +470 ''' +471 +472 __slots__ = ('version', 'start', 'max_blocks', 'num_blocks', 'data_blocks', 'data_status_blocks', 'param_blocks', +473 'rf_param_blocks', 'directory_block', 'file_log_block', 'data_and_status_block_pairs') +474 +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 = [] +478 self.data_status_blocks: list = [] +479 self.param_blocks: list = [] +480 self.rf_param_blocks: list = [] +481 self.directory_block: FileBlockInfo +482 self.file_log_block: FileBlockInfo +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(): +486 self.data_status_blocks.append(block) +487 elif block.is_rf_param(): +488 self.rf_param_blocks.append(block) +489 elif block.is_param(): +490 self.param_blocks.append(block) +491 elif block.is_directory(): +492 self.directory_block = block +493 elif block.is_file_log(): +494 self.file_log_block = block +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() +499 +500 def __str__(self): +501 data_keys = [b.get_data_key() for b in self.data_blocks] +502 data_str = ', '.join(data_keys) +503 return 'File Directory: ' + str(self.num_blocks) + ' total blocks; data blocks: (' + data_str + ')' +504 +505 def _pair_data_and_status_blocks(self): +506 for data_block in self.data_blocks: +507 status_matches = [block for block in self.data_status_blocks if block.is_data_status_match(data_block)] +508 if len(status_matches) == 0: +509 text = 'Warning: No data status block match for data block: ' + str(data_block) \ +510 + '\n\tdata block will be ignored.' +511 warnings.warn(text) +512 elif len(status_matches) > 1: +513 text = 'Warning: Multiple data status block matches for data block: ' + str(data_block) \ +514 + '\n\tMatches:' + '; '.join([str(match) for match in status_matches]) \ +515 + '\n\tdata block will be ignored.' +516 warnings.warn(text) +517 else: +518 self.data_and_status_block_pairs.append((data_block, status_matches[0]))Attributes:
465 def __init__(self, filebytes: bytes): -466 self.version, self.start, self.max_blocks, self.num_blocks = parse_header(filebytes) -467 self.data_blocks: list = [] -468 self.data_status_blocks: list = [] -469 self.param_blocks: list = [] -470 self.rf_param_blocks: list = [] -471 self.directory_block: FileBlockInfo -472 self.file_log_block: FileBlockInfo -473 for block_type, size, start in parse_directory(filebytes, self.start, self.num_blocks): -474 block = FileBlockInfo(block_type=block_type, size=size, start=start) -475 if block.is_data_status(): -476 self.data_status_blocks.append(block) -477 elif block.is_rf_param(): -478 self.rf_param_blocks.append(block) -479 elif block.is_param(): -480 self.param_blocks.append(block) -481 elif block.is_directory(): -482 self.directory_block = block -483 elif block.is_file_log(): -484 self.file_log_block = block -485 elif block.is_valid(): -486 self.data_blocks.append(block) -487 self.data_and_status_block_pairs = [] -488 self._pair_data_and_status_blocks() +diff --git a/docs/brukeropus/file/parser.html b/docs/brukeropus/file/parser.html index 5896084..215ab09 100644 --- a/docs/brukeropus/file/parser.html +++ b/docs/brukeropus/file/parser.html @@ -224,9 +224,9 @@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 = [] +478 self.data_status_blocks: list = [] +479 self.param_blocks: list = [] +480 self.rf_param_blocks: list = [] +481 self.directory_block: FileBlockInfo +482 self.file_log_block: FileBlockInfo +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(): +486 self.data_status_blocks.append(block) +487 elif block.is_rf_param(): +488 self.rf_param_blocks.append(block) +489 elif block.is_param(): +490 self.param_blocks.append(block) +491 elif block.is_directory(): +492 self.directory_block = block +493 elif block.is_file_log(): +494 self.file_log_block = block +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()144 if 's' in fmt_str: 145 x00_pos = val.find(b'\x00') 146 if x00_pos != -1: -147 val = val[:x00_pos].decode('utf-8') +147 val = val[:x00_pos].decode('latin-1') 148 else: -149 val = val.decode('utf-8') +149 val = val.decode('latin-1') 150 except Exception as e: 151 val = 'Failed to load: ' + str(e) 152 yield key, val @@ -351,10 +351,10 @@
271 for entry in byte_strings: 272 if entry != b'': 273 try: -274 strings.append(entry.decode('utf-8')) +274 strings.append(entry.decode('latin-1')) 275 except Exception: 276 try: -277 strings.append(entry.decode('latin-1')) +277 strings.append(entry.decode('utf-8')) 278 except Exception as e: 279 strings.append('<Decode Exception>: ' + str(e)) 280 return strings @@ -657,9 +657,9 @@
Yields:
145 if 's' in fmt_str: 146 x00_pos = val.find(b'\x00') 147 if x00_pos != -1: -148 val = val[:x00_pos].decode('utf-8') +148 val = val[:x00_pos].decode('latin-1') 149 else: -150 val = val.decode('utf-8') +150 val = val.decode('latin-1') 151 except Exception as e: 152 val = 'Failed to load: ' + str(e) 153 yield key, val @@ -939,10 +939,10 @@Returns:
272 for entry in byte_strings: 273 if entry != b'': 274 try: -275 strings.append(entry.decode('utf-8')) +275 strings.append(entry.decode('latin-1')) 276 except Exception: 277 try: -278 strings.append(entry.decode('latin-1')) +278 strings.append(entry.decode('utf-8')) 279 except Exception as e: 280 strings.append('<Decode Exception>: ' + str(e)) 281 return strings diff --git a/docs/search.js b/docs/search.js index b1a1b99..3d659f3 100644 --- a/docs/search.js +++ b/docs/search.js @@ -1,6 +1,6 @@ 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;e 1;){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();o 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\nInstallation
\n\n\n\n
brukeropus
requirespython 3.6+
andnumpy
, butmatplotlib
is needed to run the plotting examples. You can\ninstall with pip:\n\n\n\npip install brukeropus\n
Namespace
\n\n\n\n
brukeropus
provides direct imports to the following:\n\n\n\nfrom brukeropus import find_opus_files, read_opus, OPUSFile, Opus\n
All other file functions or classes can be directly imported from the
\n\nbrukeropus.file
orbrukeropus.control
\nsubmodules, e.g.:\n\n\n\nfrom brukeropus.file import parse_file_and_print\n
It is recommended that you do not import from the fully qualified namespace, e.g.:
\n\n\n\n\n\nfrom brukeropus.file.utils import parse_file_and_print\n
as that namespace is subject to change. Instead import directly from
\n\nbrukeropus
or its first level submodules.Reading OPUS Files (Basic Usage)
\n\n\n\n\n\nfrom 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
More detailed documentation on the file submodule can be found in
\n\nbrukeropus.file
Controlling OPUS Software (Basic Usage)
\n\n\n\n\n\nfrom 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
More detailed documentation on the control submodule can be found in
\n"}, {"fullname": "brukeropus.control", "modulename": "brukeropus.control", "kind": "module", "doc": "brukeropus.control
.The
\n\nbrukeropus.control
submodule ofbrukeropus
includes theOpus
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 asbrukeropus
.Initializing/verifying connection to OPUS Software
\n\n\n\n\n\nfrom 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
Get information about a parameter (e.g. DTC, APT, VEL).
\n\n\n\n\n\nopus = Opus()\nparam = 'vel'\nprint(opus.get_param_label(param))\nprint(opus.get_param_options(param))\n
Perform a measurement sweep
\n\n\n\n\n\nfrom 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
For complete
\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": "Opus
documentation, see:brukeropus.control.opus
Retrieve a function from a library, and set the data types.
\n", "signature": "(\tlibname,\tfuncname,\trestype=None,\targtypes=(),\t_libcache={'user32': <WinDLL 'user32', handle 7fffb73d0000>}):", "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\nUse 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
\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.disconnect", "modulename": "brukeropus.control.opus", "qualname": "Opus.disconnect", "kind": "function", "doc": "connected
attribute toTrue
if\nsuccessful. By default, initializing anOpus
class will automatically attempt to connect to OPUS.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 (
\n\nreq_str
) to OPUS and returns the response in byte format.Arguments:
\n\n\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.
\nReturns:
\n\n\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": "response: response from OPUS software through DDE request in bytes format.
\nParses 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\nArguments:
\n\n\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')
\nReturns:
\n\n\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": "response: parsed response from OPUS software (bool, string, or list of strings depending on request)
\nSends a command/request and returns the parsed response.
\n\nArguments:
\n\n\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')
\nReturns:
\n\n\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": "response: parsed response from OPUS software (bool, string, or list of strings depending on request)
\nCloses the OPUS application. Returns
\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": "True
if successful.Get the label for a three character parameter code (e.g. BMS, APT, DTC, etc...).
\n\nArguments:
\n\n\n
\n\n- param: three character parameter code (case insensitive)
\nReturns:
\n\n\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": "label: short descriptive label that defines the parameter
\nGet the parameter setting options for a three character parameter code. Only valid for\nenum type parameters (e.g. BMS, APT, DTC, etc...).
\n\nArguments:
\n\n\n
\n\n- param: three character parameter code (case insensitive)
\nReturns:
\n\n\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": "options: list of valid options (strings) for the given parameter
\nGet 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\nExamples:
\n\n\n\n\nsend_command('VAC=5') # vents the sample compartment\n send_command('VAC=4') # evacuates sample compartment
\nArguments:
\n\n\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
\nReturns:
\n\n\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": "response: parsed response from OPUS software (typically boolean confirmation)
\nEvacuates 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
\n\nfilepath
Arguments:
\n\n\n
\n\n- filepath: full path of the file to be unloaded in the software.
\nReturns:
\n\n\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": "response:
\nTrue
if successful.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\n\nmeasure_ref(nrs=100, res=4) # measures reference with current settings but overriding averages to 100 and\n resolution to 4\n
Arguments:
\n\n\n
\n\n- timeout: timeout in milliseconds to wait for response
\n- kwargs: any valid three character parameter code (case insensitive)
\nReturns:
\n\n\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": "response:
\nTrue
if successfulTakes 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\n\nmeasure_sample(nss=100, res=4) # measures sample with current settings but overriding averages to 100 and\n resolution to 4\n
Arguments:
\n\n\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)
\nReturns:
\n\n\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": "filepath: absolute filepath to measured sample file
\nPerforms 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
\n\nOPUSFile
object before it deletes the quick measurement file.Arguments:
\n\n\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)
\nReturns:
\n\n\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": "opus_file:
\nOPUSFile
object generated by quick measurementSaves current reference to file (according to current filename and path set in advanced experiment) and\nreturns the filename.
\n\nReturns:
\n\n\n\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file", "modulename": "brukeropus.file", "kind": "module", "doc": "filepath: absolute path to saved reference file
\nThe
\n\nbrukeropus.file
submodule ofbrukeropus
includes all the functions and classes for reading and exploring OPUS\nfiles. This includes both high-level functions likeread_opus
that returns anOPUSFile
class, as well as low-level\nparsing functions likeparse_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.Finding OPUS Files
\n\nOPUS 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,\n
\n\nbrukeropus
includes afind_opus_files
function:\n\n\n\nfrom brukeropus import find_opus_files\n\nfilepaths = find_opus_files(r'path\\to\\opus\\files', recursive=True)\n
Which will assign a list of filepaths that match the numeric extension formatting of OPUS files. For full documentation,\nsee
\n\nbrukeropus.file.utils.find_opus_files
.Reading OPUS Files
\n\n\n\n
brukeropus
parses OPUS files and assembles them into anOPUSFile
object that contains the extracted data (and\nmetadata) within the file. You can generate anOPUSFile
object in one of two ways:\n\n\n\nfrom brukeropus import read_opus, OPUSFile\n\nfilepath = r'path\\to\\opusfile.0'\n\ndata = read_opus(filepath)\nsame_data = OPUSFile(filepath)\n
In the above code,
\n\ndata
andsame_data
are bothOPUSFile
objects with identical data.Using the
\n\nOPUSFile
ClassOPUS 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
\n\nfalse
:\n\n\n\ndata = read_opus('file.pdf')\nif data:\n print(data)\nelse:\n print(data.filepath, 'is not an OPUS file')\n
To view all parameter metadata in the file, you can print to the console using the class method:
\n\nprint_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\ndata = read_opus('file.0')\ndata.print_parameters()\n
\n\n
\nExample
print_parameters
Output\n
\n\n\n\n\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
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
\n\nget_param_label
function:\n\n\n\nfrom 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\nBeamsplitter: KBr-Broadband\nSource: MIR\n
You will notice in the example output that some keys (e.g. zero filling factor
\n\nzff
) 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 therf_params
attribute.\n\n\n\ndata = read_opus('file.0')\nprint('Sample ZFF:', data.zff, 'Reference ZFF:', data.rf_params.zff)\n
\n\n\n\nSample ZFF: 2 Reference ZFF: 2\n
You can also iterate over the parameters using the familiar
\n\nkeys()
,values()
, anditems()
functions using the\nparams
orrf_params
attributes:\n\n\n\ndata = read_opus('file.0')\nfor key, val in data.params.items():\n print(key + ':', val)\n
\n\n\n\nacc: 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
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
\n\ndata_keys
attribute:\n\n\n\ndata = read_opus('file.0')\nprint(data.data_keys)\n
\n\n\n\n['igsm', 'phsm', 'sm', 'a', 'igrf', 'rf']\n
Each key is also an attribute of the
\n\nOPUSFile
instance that returns either aData
orData3D
class. You can get\nthex
andy
array values (in the units they were saved in) as direct attributes to theData
class:\n\n\n\ndata = read_opus('file.0')\nplt.plot(data.a.x, data.a.y)\nplt.ylim((0, 1))\nplt.show()\n
For spectra with wavenumber as valid unit (e.g. single-channel or ratioed spectra), the
\n\nx
array can be given incm\u207b\u00b9
\nor\u00b5m
units by using the attributeswn
orwl
respectively:\n\n\n\ndata = read_opus('file.0')\nplt.plot(data.sm.wl, data.sm.y)\nplt.show()\n
You can also iterate over all data spectra in the file using the
\n\niter_data()
method:\n\n\n\ndata = read_opus('file.0')\nfor d in data.iter_data():\n print(d.label, '(' + d.datetime.isoformat(' ') + ')')\n
\n\n\n\nSample 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
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
\n\nData
\nclass, or through theparams
attribute:\n\n\n\ndata = read_opus('file.0')\nprint('Sample spectra y-min:', data.sm.mny, 'y-max:', data.sm.mxy)\n
\n\n\n\nSample spectra y-min: 1.2147593224653974e-05 y-max: 0.03543896973133087\n
For full API documentation, see:
\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": "
\nOPUSFile
:brukeropus.file.file.OPUSFile
\nData
:brukeropus.file.file.Data
\nData3D
:brukeropus.file.file.Data3D
Return an
\n\nOPUSFile
object from an OPUS file filepath.The following produces identical results:
\n\n\n\n\n\n\n\ndata = read_opus(filepath)\ndata = OPUSFile(filepath)\n
Arguments:
\n\n\n
\n\n- filepath (str or Path): filepath of an OPUS file (typically *.0)
\nReturns:
\n\n\n\n", "signature": "(filepath):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.OPUSFile", "modulename": "brukeropus.file.file", "qualname": "OPUSFile", "kind": "class", "doc": "opus_file (
\nOPUSFile
): an instance of theOPUSFile
class containing all data/metadata extracted from the\n file.Class that contains the data and metadata contained in a bruker OPUS file.
\n\nArguments:
\n\n\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
\nOPUSFile
object.Attributes:
\n\n\n
\n\n- is_opus (
\nbool
): True if filepath points to an OPUS file, False otherwise. Also returned for dunder \n__bool__()
- params (
\nParameters
): class containing all general parameter metadata for the OPUS file. To save typing, the\nthree char parameters from params also become attributes of theOPUSFile
class (e.g. bms, apt, src)- rf_params (
\nParameters
): class containing all reference parameter metadata for the OPUS file.- 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
\nData
orData3D
.- datetime (
\ndatetime
): Returns the most recent datetime of all the data blocks stored in the file (typically\nresult spectra)- directory (
\nFileDirectory
): class containing information about all the various data blocks in the file.- file_log (str): File log containing text about how the file was generated/edited (not always saved)
\nData Attributes:
\n\n\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": "sm: Single-channel sample spectra
\n
\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: PhotoacousticPrints 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\nThis information is parsed from the directory block of an OPUS file and provides the information needed to parse the\nblock.
\n\nArguments:
\n\n\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.
\nAttributes:
\n\n\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": "- 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.
\nReturns 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\nThis function is used to match a data status block (contains metadata for data block) with its associated data\nblock (contains array data).
\n\nArguments:
\n\n\n
\n\n- data_block_info (FileBlockInfo): data block being tested as a match.
\nReturns:
\n\n\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": "is_match (bool): True if FileBlockInfo is data status block and input argument is matching data block
\nReturns 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\ne.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\nArguments:
\n\n\n
\n\n- filebytes: raw bytes from OPUS file. see:
\nread_opus_file_bytes
- data_info:
\nFileBlockInfo
instance of a data block- data_status_info:
\nFileBlockInfo
instance of a data status block which contains metadata about the data_info\nblock. This block is a parameter block.Attributes:
\n\n\n
\n\n- params:
\nParameter
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.- y: 1D
\nnumpy
array containing y values of data block- x: 1D
\nnumpy
array containing x values of data block. Units of x array are given bydxu
parameter.- label: human-readable string label describing the data block (e.g. Sample Spectrum, Absorbance, etc.)
\nExtended Attributes:
\n\n\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": "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
\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 adatetime
class of when the data was taken (extracted from data status parameter block).
\n xxx: the various three char parameter keys from theparams
attribute can be directly called from the \nData
class for convenience. Common parameters includedxu
(x units),mxy
(max y value),mny
(min y\n value), etc.Class containing 3D array data (series of spectra) and associated parameter/metadata from an OPUS file.
\n\nArguments:
\n\n\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.
\nAttributes:
\n\n\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.)
\nExtended Attributes:
\n\n\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": "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
\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 adatetime
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
.Class containing parameter metadata of an OPUS file.
\n\nParameters 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
\n\nbrukeropus.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 parameterFileBlockInfo
. 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()
, anditems()
\nrespectively.Arguments:
\n\n\n
\n\n- filebytes: raw bytes from OPUS file. see:
\nbrukeropus.file.parser.read_opus_file_bytes
- param_blocks: list of
\nFileBlockInfo
; every block in the list should be classified as a parameter block.Attributes:
\n\n\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": "- xxx: parameter attributes are stored as three char keys. Which keys are generated depends on the list of\n
\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 thekeys()
method.- datetime: if blocks contain the keys:
\ndat
(date) andtim
(time), thedatetime
attribute of this class will\nbe set to a pythondatetime
object. Currently, only data status blocks are known to have these keys. If\ndat
andtim
are not present in the class, thedatetime
attribute will returnNone
.Returns a
\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.Parameters.values", "modulename": "brukeropus.file.file", "qualname": "Parameters.values", "kind": "function", "doc": "dict_keys
class of all valid keys in the class (i.e. dict.keys())Returns a
\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.Parameters.items", "modulename": "brukeropus.file.file", "qualname": "Parameters.items", "kind": "function", "doc": "dict_values
class of all the values in the class (i.e. dict.values())Returns a
\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": "dict_items
class of all the values in the class (i.e. dict.items())Contains type and pointer information for all blocks of data in an OPUS file.
\n\n\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
, andfile_log
. It also pairs the data\nblocks with their correspondingdata_status
block to simplify grouping y data with the parameters that are used to\ngenerate x data and other data block specific metadata.Arguments:
\n\n\n
\n\n- filebytes: raw bytes from OPUS file. see:
\nbrukeropus.file.parser.read_opus_file_bytes
Attributes:
\n\n\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": "- 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
\nFileBlockInfo
that contain array data (e.g. sample, reference, phase)- data_status_blocks: list of
\nFileBlockInfo
that contain metadata specific to a data block (units, etc.)- param_blocks: list of
\nFileBlockInfo
that contain metadata about the measurement sample- rf_param_blocks: list of
\nFileBlockInfo
that contain metatdata about the reference measurement- directory_block:
\nFileBlockInfo
for directory block that contains all the block info in the file- file_log_block:
\nFileBlockInfo
of the file log (changes, etc.)- data_and_status_block_pairs: (data:
\nFileBlockInfo
, data_status:FileBlockInfo
) which pairs the data status\nparameter block (time, x units, y units, etc.) with the data block it informsReturns
\n\nbytes
of an OPUS file specified byfilepath
(orNone
).Function determines if
\n\nfilepath
points to an OPUS file by reading the first four bytes which are always the same\nfor OPUS files. Iffilepath
is not a file, or points to a non-OPUS file, the function returnsNone
. Otherwise\nthe function returns the entire file as rawbytes
.Arguments:
\n\n\n
\n\n- filepath (str or Path): full filepath to OPUS file
\nReturns:
\n\n\n\n", "signature": "(filepath):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.get_block_type", "modulename": "brukeropus.file.parser", "qualname": "get_block_type", "kind": "function", "doc": "filebytes (bytes): raw bytes of OPUS file or
\nNone
(if filepath does not point to an OPUS file)Converts an int32 block type code to a six-integer tuple
\n\nblock_type
.This function is used to decode the
\n\ntype_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.Arguments:
\n\n\n
\n\n- type_int: 32-bit integer decoded from file directory block
\nReturns:
\n\n\n\n", "signature": "(type_int: int):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.parse_header", "modulename": "brukeropus.file.parser", "qualname": "parse_header", "kind": "function", "doc": "block_type (tuple): six-integer tuple which specifies the block type
\nParses the OPUS file header.
\n\nThe 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\nArguments:
\n\n\n
\n\n- filebytes: raw bytes of OPUS file (all bytes)
\nReturns:
\n\n\n\n", "signature": "(filebytes: bytes):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.parse_directory", "modulename": "brukeropus.file.parser", "qualname": "parse_directory", "kind": "function", "doc": "header_info (tuple):
\n
\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 )Parses directory block of OPUS file and yields block info for all blocks in the file as a generator.
\n\nThe directory block of an OPUS file contains information about every block in the file. The block information is\nstored as three int32 values:
\n\ntype_int
,size_int
,start
.type_int
is an integer representation of the block\ntype. The bits of thistype_int
have meaning and are parsed into a tuple usingget_block_type
. Thesize_int
is\nthe size of the block in 32-bit words.start
is the starting location of the block (in number of bytes).Arguments:
\n\n\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)
\nYields:
\n\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": "block_info (tuple):
\n
\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 )Parses the bytes in a parameter block and yields the key, value pairs as a generator.
\n\nParameter blocks are in the form:
\n\nXXX
,dtype_code
,size
,val
.XXX
is a three char abbreviation of the\nparameter (key). The value of the parameter is decoded according to thedtype_code
and size integers to be either:\nint
,float
, orstring
.Arguments:
\n\n\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)
\nYields:
\n\n\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": "items (tuple): (key, value) pairs where key is three char string (lowercase) and value can be
\nint
,float
\n orstring
.Returns numpy dtype and array count from the data point format (dpf) and block size (in bytes).
\n\nArguments:
\n\n\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.
\nReturns:
\n\n\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": "dtype (numpy.dtype):
\nnumpy
dtype for defining anndarray
to store the data\n count (int): length of array calculated from the block size and byte size of the dtype.Parses the bytes in a data block (specified by
\n\nsize
andstart
pointers) and returns anumpy
array.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
\n\nDPF
parameter. It\nappears that OPUS currently exclusively stores data blocks as 32-bit floats, but has a reservation for 32-bit\nintegers whenDPF
= 2.Arguments:
\n\n\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.
\nReturns:
\n\n\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": "y_array (numpy.ndarray):
\nnumpy
array of y values contained in the data blockParses the bytes in a 3D data block (series of spectra) and returns a data
\n\ndict
containing data and metadata.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
\n\ndict
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).Arguments:
\n\n\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.
\nReturns:
\n\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": "data_dict (dict):
\ndict
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: 2Dnumpy
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 generallytim
, which can be used as the time axis for 3D data plots.
\n }Parses the file log in an OPUS file and returns a list of strings contained in the log.
\n\nThe 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\nArguments:
\n\n\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
\nReturns:
\n\n\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": "strings (list): list of strings found in the file log.
\nFinds all files in a directory with a strictly numeric extension (OPUS file convention).
\n\nReturns 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\nArguments:
\n\n\n
\n\n- directory (str or Path): path indicating directory to search
\n- recursive: Set to True to recursively search sub directories as well
\nReturns:
\n\n\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": "filepaths (list): list of filepaths that match OPUS naming convention (numeric extension)
\nReturns a short but descriptive label for 3-letter parameters. For example, bms returns Beamsplitter.
\n\nThe 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\nArguments:
\n\n\n
\n\n- param: three letter parameter code (e.g. bms, src, npt, etc.) [not case sensitive]
\nReturns:
\n\n\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": "label (str): Human-readable string label for the parameter.
\nReturns the type code label of a file block given the position index and value of the type code.
\n\nThe 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\n\n0: Undefined or N/A,\n1: Real Part of Complex Data,\n2: Imaginary Part of Complex Data,\n3: Amplitude\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\nArguments:
\n\n\n
\n\n- pos_idx: positional index of the type code (0 - 5)
\n- val: value of the type code
\nReturns:
\n\n\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": "label (str): human-readable string label that describes the type code.
\nConverts a six-integer tuple block type into a human readable label.
\n\nArguments:
\n\n\n
\n\n- block_type: six integer tuple found in the OPUS file directory that describes the block type
\nReturns:
\n\n\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": "label (str): human-readable string label
\nReturns a shorthand key for a given data block type: sm, rf, igsm, a, t, r, etc.
\n\nDetermines 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\nArguments:
\n\n\n
\n\n- block_type: six integer tuple found in the OPUS file directory that describes the block type
\nReturns:
\n\n\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": "key (str): shorthand string label that can be utilized as a data key (e.g. \"sm\", \"igrf\", \"a\")
\nParses an OPUS file and prints the block information as it goes along to the console.
\n\nThis 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\nArguments:
\n\n\n
\n", "signature": "(filepath, width=120):", "funcdef": "def"}]; + /** pdoc search index */const docs = [{"fullname": "brukeropus", "modulename": "brukeropus", "kind": "module", "doc": "- filepath (str or Path): filepath to an OPUS file.
\n\n\n
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)Installation
\n\n\n\n
brukeropus
requirespython 3.6+
andnumpy
, butmatplotlib
is needed to run the plotting examples. You can\ninstall with pip:\n\n\n\npip install brukeropus\n
Namespace
\n\n\n\n
brukeropus
provides direct imports to the following:\n\n\n\nfrom brukeropus import find_opus_files, read_opus, OPUSFile, Opus\n
All other file functions or classes can be directly imported from the
\n\nbrukeropus.file
orbrukeropus.control
\nsubmodules, e.g.:\n\n\n\nfrom brukeropus.file import parse_file_and_print\n
It is recommended that you do not import from the fully qualified namespace, e.g.:
\n\n\n\n\n\nfrom brukeropus.file.utils import parse_file_and_print\n
as that namespace is subject to change. Instead import directly from
\n\nbrukeropus
or its first level submodules.Reading OPUS Files (Basic Usage)
\n\n\n\n\n\nfrom 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
More detailed documentation on the file submodule can be found in
\n\nbrukeropus.file
Controlling OPUS Software (Basic Usage)
\n\n\n\n\n\nfrom 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
More detailed documentation on the control submodule can be found in
\n"}, {"fullname": "brukeropus.control", "modulename": "brukeropus.control", "kind": "module", "doc": "brukeropus.control
.The
\n\nbrukeropus.control
submodule ofbrukeropus
includes theOpus
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 asbrukeropus
.Initializing/verifying connection to OPUS Software
\n\n\n\n\n\nfrom 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
Get information about a parameter (e.g. DTC, APT, VEL).
\n\n\n\n\n\nopus = Opus()\nparam = 'vel'\nprint(opus.get_param_label(param))\nprint(opus.get_param_options(param))\n
Perform a measurement sweep
\n\n\n\n\n\nfrom 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
For complete
\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": "Opus
documentation, see:brukeropus.control.opus
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\nUse 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
\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.control.opus.Opus.disconnect", "modulename": "brukeropus.control.opus", "qualname": "Opus.disconnect", "kind": "function", "doc": "connected
attribute toTrue
if\nsuccessful. By default, initializing anOpus
class will automatically attempt to connect to OPUS.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 (
\n\nreq_str
) to OPUS and returns the response in byte format.Arguments:
\n\n\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.
\nReturns:
\n\n\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": "response: response from OPUS software through DDE request in bytes format.
\nParses 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\nArguments:
\n\n\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')
\nReturns:
\n\n\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": "response: parsed response from OPUS software (bool, string, or list of strings depending on request)
\nSends a command/request and returns the parsed response.
\n\nArguments:
\n\n\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')
\nReturns:
\n\n\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": "response: parsed response from OPUS software (bool, string, or list of strings depending on request)
\nCloses the OPUS application. Returns
\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": "True
if successful.Get the label for a three character parameter code (e.g. BMS, APT, DTC, etc...).
\n\nArguments:
\n\n\n
\n\n- param: three character parameter code (case insensitive)
\nReturns:
\n\n\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": "label: short descriptive label that defines the parameter
\nGet the parameter setting options for a three character parameter code. Only valid for\nenum type parameters (e.g. BMS, APT, DTC, etc...).
\n\nArguments:
\n\n\n
\n\n- param: three character parameter code (case insensitive)
\nReturns:
\n\n\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": "options: list of valid options (strings) for the given parameter
\nGet 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\nExamples:
\n\n\n\n\nsend_command('VAC=5') # vents the sample compartment\n send_command('VAC=4') # evacuates sample compartment
\nArguments:
\n\n\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
\nReturns:
\n\n\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": "response: parsed response from OPUS software (typically boolean confirmation)
\nEvacuates 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
\n\nfilepath
Arguments:
\n\n\n
\n\n- filepath: full path of the file to be unloaded in the software.
\nReturns:
\n\n\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": "response:
\nTrue
if successful.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\n\nmeasure_ref(nrs=100, res=4) # measures reference with current settings but overriding averages to 100 and\n resolution to 4\n
Arguments:
\n\n\n
\n\n- timeout: timeout in milliseconds to wait for response
\n- kwargs: any valid three character parameter code (case insensitive)
\nReturns:
\n\n\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": "response:
\nTrue
if successfulTakes 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\n\nmeasure_sample(nss=100, res=4) # measures sample with current settings but overriding averages to 100 and\n resolution to 4\n
Arguments:
\n\n\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)
\nReturns:
\n\n\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": "filepath: absolute filepath to measured sample file
\nPerforms 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
\n\nOPUSFile
object before it deletes the quick measurement file.Arguments:
\n\n\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)
\nReturns:
\n\n\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": "opus_file:
\nOPUSFile
object generated by quick measurementSaves current reference to file (according to current filename and path set in advanced experiment) and\nreturns the filename.
\n\nReturns:
\n\n\n\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file", "modulename": "brukeropus.file", "kind": "module", "doc": "filepath: absolute path to saved reference file
\nThe
\n\nbrukeropus.file
submodule ofbrukeropus
includes all the functions and classes for reading and exploring OPUS\nfiles. This includes both high-level functions likeread_opus
that returns anOPUSFile
class, as well as low-level\nparsing functions likeparse_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.Finding OPUS Files
\n\nOPUS 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,\n
\n\nbrukeropus
includes afind_opus_files
function:\n\n\n\nfrom brukeropus import find_opus_files\n\nfilepaths = find_opus_files(r'path\\to\\opus\\files', recursive=True)\n
Which will assign a list of filepaths that match the numeric extension formatting of OPUS files. For full documentation,\nsee
\n\nbrukeropus.file.utils.find_opus_files
.Reading OPUS Files
\n\n\n\n
brukeropus
parses OPUS files and assembles them into anOPUSFile
object that contains the extracted data (and\nmetadata) within the file. You can generate anOPUSFile
object in one of two ways:\n\n\n\nfrom brukeropus import read_opus, OPUSFile\n\nfilepath = r'path\\to\\opusfile.0'\n\ndata = read_opus(filepath)\nsame_data = OPUSFile(filepath)\n
In the above code,
\n\ndata
andsame_data
are bothOPUSFile
objects with identical data.Using the
\n\nOPUSFile
ClassOPUS 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
\n\nfalse
:\n\n\n\ndata = read_opus('file.pdf')\nif data:\n print(data)\nelse:\n print(data.filepath, 'is not an OPUS file')\n
To view all parameter metadata in the file, you can print to the console using the class method:
\n\nprint_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\ndata = read_opus('file.0')\ndata.print_parameters()\n
\n\n
\nExample
print_parameters
Output\n
\n\n\n\n\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
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
\n\nget_param_label
function:\n\n\n\nfrom 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\nBeamsplitter: KBr-Broadband\nSource: MIR\n
You will notice in the example output that some keys (e.g. zero filling factor
\n\nzff
) 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 therf_params
attribute.\n\n\n\ndata = read_opus('file.0')\nprint('Sample ZFF:', data.zff, 'Reference ZFF:', data.rf_params.zff)\n
\n\n\n\nSample ZFF: 2 Reference ZFF: 2\n
You can also iterate over the parameters using the familiar
\n\nkeys()
,values()
, anditems()
functions using the\nparams
orrf_params
attributes:\n\n\n\ndata = read_opus('file.0')\nfor key, val in data.params.items():\n print(key + ':', val)\n
\n\n\n\nacc: 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
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
\n\ndata_keys
attribute:\n\n\n\ndata = read_opus('file.0')\nprint(data.data_keys)\n
\n\n\n\n['igsm', 'phsm', 'sm', 'a', 'igrf', 'rf']\n
Each key is also an attribute of the
\n\nOPUSFile
instance that returns either aData
orData3D
class. You can get\nthex
andy
array values (in the units they were saved in) as direct attributes to theData
class:\n\n\n\ndata = read_opus('file.0')\nplt.plot(data.a.x, data.a.y)\nplt.ylim((0, 1))\nplt.show()\n
For spectra with wavenumber as valid unit (e.g. single-channel or ratioed spectra), the
\n\nx
array can be given incm\u207b\u00b9
\nor\u00b5m
units by using the attributeswn
orwl
respectively:\n\n\n\ndata = read_opus('file.0')\nplt.plot(data.sm.wl, data.sm.y)\nplt.show()\n
You can also iterate over all data spectra in the file using the
\n\niter_data()
method:\n\n\n\ndata = read_opus('file.0')\nfor d in data.iter_data():\n print(d.label, '(' + d.datetime.isoformat(' ') + ')')\n
\n\n\n\nSample 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
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
\n\nData
\nclass, or through theparams
attribute:\n\n\n\ndata = read_opus('file.0')\nprint('Sample spectra y-min:', data.sm.mny, 'y-max:', data.sm.mxy)\n
\n\n\n\nSample spectra y-min: 1.2147593224653974e-05 y-max: 0.03543896973133087\n
For full API documentation, see:
\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": "
\nOPUSFile
:brukeropus.file.file.OPUSFile
\nData
:brukeropus.file.file.Data
\nData3D
:brukeropus.file.file.Data3D
Return an
\n\nOPUSFile
object from an OPUS file filepath.The following produces identical results:
\n\n\n\n\n\n\n\ndata = read_opus(filepath)\ndata = OPUSFile(filepath)\n
Arguments:
\n\n\n
\n\n- filepath (str or Path): filepath of an OPUS file (typically *.0)
\nReturns:
\n\n\n\n", "signature": "(filepath):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.OPUSFile", "modulename": "brukeropus.file.file", "qualname": "OPUSFile", "kind": "class", "doc": "opus_file (
\nOPUSFile
): an instance of theOPUSFile
class containing all data/metadata extracted from the\n file.Class that contains the data and metadata contained in a bruker OPUS file.
\n\nArguments:
\n\n\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
\nOPUSFile
object.Attributes:
\n\n\n
\n\n- is_opus (
\nbool
): True if filepath points to an OPUS file, False otherwise. Also returned for dunder \n__bool__()
- params (
\nParameters
): class containing all general parameter metadata for the OPUS file. To save typing, the\nthree char parameters from params also become attributes of theOPUSFile
class (e.g. bms, apt, src)- rf_params (
\nParameters
): class containing all reference parameter metadata for the OPUS file.- 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
\nData
orData3D
.- datetime (
\ndatetime
): Returns the most recent datetime of all the data blocks stored in the file (typically\nresult spectra)- directory (
\nFileDirectory
): class containing information about all the various data blocks in the file.- file_log (str): File log containing text about how the file was generated/edited (not always saved)
\nData Attributes:
\n\n\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": "sm: Single-channel sample spectra
\n
\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: PhotoacousticPrints 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\nThis information is parsed from the directory block of an OPUS file and provides the information needed to parse the\nblock.
\n\nArguments:
\n\n\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.
\nAttributes:
\n\n\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": "- 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.
\nReturns 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\nThis function is used to match a data status block (contains metadata for data block) with its associated data\nblock (contains array data).
\n\nArguments:
\n\n\n
\n\n- data_block_info (FileBlockInfo): data block being tested as a match.
\nReturns:
\n\n\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": "is_match (bool): True if FileBlockInfo is data status block and input argument is matching data block
\nReturns 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\ne.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\nArguments:
\n\n\n
\n\n- filebytes: raw bytes from OPUS file. see:
\nread_opus_file_bytes
- data_info:
\nFileBlockInfo
instance of a data block- data_status_info:
\nFileBlockInfo
instance of a data status block which contains metadata about the data_info\nblock. This block is a parameter block.Attributes:
\n\n\n
\n\n- params:
\nParameter
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.- y: 1D
\nnumpy
array containing y values of data block- x: 1D
\nnumpy
array containing x values of data block. Units of x array are given bydxu
parameter.- label: human-readable string label describing the data block (e.g. Sample Spectrum, Absorbance, etc.)
\nExtended Attributes:
\n\n\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": "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
\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 adatetime
class of when the data was taken (extracted from data status parameter block).
\n xxx: the various three char parameter keys from theparams
attribute can be directly called from the \nData
class for convenience. Common parameters includedxu
(x units),mxy
(max y value),mny
(min y\n value), etc.Class containing 3D array data (series of spectra) and associated parameter/metadata from an OPUS file.
\n\nArguments:
\n\n\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.
\nAttributes:
\n\n\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.)
\nExtended Attributes:
\n\n\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": "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
\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 adatetime
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
.Class containing parameter metadata of an OPUS file.
\n\nParameters 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
\n\nbrukeropus.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 parameterFileBlockInfo
. 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()
, anditems()
\nrespectively.Arguments:
\n\n\n
\n\n- filebytes: raw bytes from OPUS file. see:
\nbrukeropus.file.parser.read_opus_file_bytes
- param_blocks: list of
\nFileBlockInfo
; every block in the list should be classified as a parameter block.Attributes:
\n\n\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": "- xxx: parameter attributes are stored as three char keys. Which keys are generated depends on the list of\n
\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 thekeys()
method.- datetime: if blocks contain the keys:
\ndat
(date) andtim
(time), thedatetime
attribute of this class will\nbe set to a pythondatetime
object. Currently, only data status blocks are known to have these keys. If\ndat
andtim
are not present in the class, thedatetime
attribute will returnNone
.Returns a
\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.Parameters.values", "modulename": "brukeropus.file.file", "qualname": "Parameters.values", "kind": "function", "doc": "dict_keys
class of all valid keys in the class (i.e. dict.keys())Returns a
\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "brukeropus.file.file.Parameters.items", "modulename": "brukeropus.file.file", "qualname": "Parameters.items", "kind": "function", "doc": "dict_values
class of all the values in the class (i.e. dict.values())Returns a
\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": "dict_items
class of all the values in the class (i.e. dict.items())Contains type and pointer information for all blocks of data in an OPUS file.
\n\n\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
, andfile_log
. It also pairs the data\nblocks with their correspondingdata_status
block to simplify grouping y data with the parameters that are used to\ngenerate x data and other data block specific metadata.Arguments:
\n\n\n
\n\n- filebytes: raw bytes from OPUS file. see:
\nbrukeropus.file.parser.read_opus_file_bytes
Attributes:
\n\n\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": "- 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
\nFileBlockInfo
that contain array data (e.g. sample, reference, phase)- data_status_blocks: list of
\nFileBlockInfo
that contain metadata specific to a data block (units, etc.)- param_blocks: list of
\nFileBlockInfo
that contain metadata about the measurement sample- rf_param_blocks: list of
\nFileBlockInfo
that contain metatdata about the reference measurement- directory_block:
\nFileBlockInfo
for directory block that contains all the block info in the file- file_log_block:
\nFileBlockInfo
of the file log (changes, etc.)- data_and_status_block_pairs: (data:
\nFileBlockInfo
, data_status:FileBlockInfo
) which pairs the data status\nparameter block (time, x units, y units, etc.) with the data block it informsReturns
\n\nbytes
of an OPUS file specified byfilepath
(orNone
).Function determines if
\n\nfilepath
points to an OPUS file by reading the first four bytes which are always the same\nfor OPUS files. Iffilepath
is not a file, or points to a non-OPUS file, the function returnsNone
. Otherwise\nthe function returns the entire file as rawbytes
.Arguments:
\n\n\n
\n\n- filepath (str or Path): full filepath to OPUS file
\nReturns:
\n\n\n\n", "signature": "(filepath):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.get_block_type", "modulename": "brukeropus.file.parser", "qualname": "get_block_type", "kind": "function", "doc": "filebytes (bytes): raw bytes of OPUS file or
\nNone
(if filepath does not point to an OPUS file)Converts an int32 block type code to a six-integer tuple
\n\nblock_type
.This function is used to decode the
\n\ntype_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.Arguments:
\n\n\n
\n\n- type_int: 32-bit integer decoded from file directory block
\nReturns:
\n\n\n\n", "signature": "(type_int: int):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.parse_header", "modulename": "brukeropus.file.parser", "qualname": "parse_header", "kind": "function", "doc": "block_type (tuple): six-integer tuple which specifies the block type
\nParses the OPUS file header.
\n\nThe 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\nArguments:
\n\n\n
\n\n- filebytes: raw bytes of OPUS file (all bytes)
\nReturns:
\n\n\n\n", "signature": "(filebytes: bytes):", "funcdef": "def"}, {"fullname": "brukeropus.file.parser.parse_directory", "modulename": "brukeropus.file.parser", "qualname": "parse_directory", "kind": "function", "doc": "header_info (tuple):
\n
\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 )Parses directory block of OPUS file and yields block info for all blocks in the file as a generator.
\n\nThe directory block of an OPUS file contains information about every block in the file. The block information is\nstored as three int32 values:
\n\ntype_int
,size_int
,start
.type_int
is an integer representation of the block\ntype. The bits of thistype_int
have meaning and are parsed into a tuple usingget_block_type
. Thesize_int
is\nthe size of the block in 32-bit words.start
is the starting location of the block (in number of bytes).Arguments:
\n\n\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)
\nYields:
\n\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": "block_info (tuple):
\n
\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 )Parses the bytes in a parameter block and yields the key, value pairs as a generator.
\n\nParameter blocks are in the form:
\n\nXXX
,dtype_code
,size
,val
.XXX
is a three char abbreviation of the\nparameter (key). The value of the parameter is decoded according to thedtype_code
and size integers to be either:\nint
,float
, orstring
.Arguments:
\n\n\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)
\nYields:
\n\n\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": "items (tuple): (key, value) pairs where key is three char string (lowercase) and value can be
\nint
,float
\n orstring
.Returns numpy dtype and array count from the data point format (dpf) and block size (in bytes).
\n\nArguments:
\n\n\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.
\nReturns:
\n\n\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": "dtype (numpy.dtype):
\nnumpy
dtype for defining anndarray
to store the data\n count (int): length of array calculated from the block size and byte size of the dtype.Parses the bytes in a data block (specified by
\n\nsize
andstart
pointers) and returns anumpy
array.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
\n\nDPF
parameter. It\nappears that OPUS currently exclusively stores data blocks as 32-bit floats, but has a reservation for 32-bit\nintegers whenDPF
= 2.Arguments:
\n\n\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.
\nReturns:
\n\n\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": "y_array (numpy.ndarray):
\nnumpy
array of y values contained in the data blockParses the bytes in a 3D data block (series of spectra) and returns a data
\n\ndict
containing data and metadata.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
\n\ndict
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).Arguments:
\n\n\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.
\nReturns:
\n\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": "data_dict (dict):
\ndict
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: 2Dnumpy
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 generallytim
, which can be used as the time axis for 3D data plots.
\n }Parses the file log in an OPUS file and returns a list of strings contained in the log.
\n\nThe 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\nArguments:
\n\n\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
\nReturns:
\n\n\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": "strings (list): list of strings found in the file log.
\nFinds all files in a directory with a strictly numeric extension (OPUS file convention).
\n\nReturns 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\nArguments:
\n\n\n
\n\n- directory (str or Path): path indicating directory to search
\n- recursive: Set to True to recursively search sub directories as well
\nReturns:
\n\n\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": "filepaths (list): list of filepaths that match OPUS naming convention (numeric extension)
\nReturns a short but descriptive label for 3-letter parameters. For example, bms returns Beamsplitter.
\n\nThe 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\nArguments:
\n\n\n
\n\n- param: three letter parameter code (e.g. bms, src, npt, etc.) [not case sensitive]
\nReturns:
\n\n\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": "label (str): Human-readable string label for the parameter.
\nReturns the type code label of a file block given the position index and value of the type code.
\n\nThe 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\n\n0: Undefined or N/A,\n1: Real Part of Complex Data,\n2: Imaginary Part of Complex Data,\n3: Amplitude\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\nArguments:
\n\n\n
\n\n- pos_idx: positional index of the type code (0 - 5)
\n- val: value of the type code
\nReturns:
\n\n\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": "label (str): human-readable string label that describes the type code.
\nConverts a six-integer tuple block type into a human readable label.
\n\nArguments:
\n\n\n
\n\n- block_type: six integer tuple found in the OPUS file directory that describes the block type
\nReturns:
\n\n\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": "label (str): human-readable string label
\nReturns a shorthand key for a given data block type: sm, rf, igsm, a, t, r, etc.
\n\nDetermines 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\nArguments:
\n\n\n
\n\n- block_type: six integer tuple found in the OPUS file directory that describes the block type
\nReturns:
\n\n\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": "key (str): shorthand string label that can be utilized as a data key (e.g. \"sm\", \"igrf\", \"a\")
\nParses an OPUS file and prints the block information as it goes along to the console.
\n\nThis 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\nArguments:
\n\n\n
\n", "signature": "(filepath, width=120):", "funcdef": "def"}]; // mirrored in build-search-index.js (part 1) // Also split on html tags. this is a cheap heuristic, but good enough.- filepath (str or Path): filepath to an OPUS file.
\n