brukeropus.file

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

Finding OPUS Files

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

from brukeropus import find_opus_files

filepaths = find_opus_files(r'path\to\opus\files', recursive=True)

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

Reading OPUS Files

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

from brukeropus import read_opus, OPUSFile

filepath = r'path\to\opusfile.0'

data = read_opus(filepath)
same_data = OPUSFile(filepath)

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

Using the OPUSFile Class

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

data = read_opus('file.pdf')
if data:
    print(data)
else:
    print(data.filepath, 'is not an OPUS file')

The OPUSFile class provides an interface for accessing the data (stored as blocks) in an OPUS file. Accessible data includes:

Parameters (brukeropus.file.params): measurement metadata

Data (brukeropus.file.data.Data): measurements spectra (1D)

DataSeries (brukeropus.file.data.DataSeries): series of measurements spectra (3D)

Report (brukeropus.file.report): tabular report info (e.g. multi-evaluation test reports)

To view a quick summary of the data contained in an OPUSFile instance, simply print it to the console:

data = read_opus('file.0')
print(data)
========================================================================================================================
                                                 OPUS File: file.0
Attribute      Class type          Description
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
params         Parameters          Optical, Fourier Transform, Acquisition, Sample Origin, Instrument Status Parameters
rf_params      Parameters          Instrument Status, Optical, Acquisition, Fourier Transform Reference Parameters
rf             Data                Reference Spectrum
igrf           Data                Reference Interferogram
a              Data                Absorbance
sm             Data                Sample Spectrum
phsm           Data                Sample Phase
igsm           Data                Sample Interferogram
history        str                 History log of file
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

The output listed here will depend on what data blocks were saved in the OPUS file. The following sections will go over the various data class types in more detail.

Parameters (brukeropus.file.params.Parameters)

The metadata in an OPUS file is stored in Parameters classes. These classes can be stored in the params and rf_params attributes which contain the sample and reference parameter metadata respectively.

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

data = read_opus('file.0')
data.print_parameters()

Example print_parameters Output

====================================================================================================
                                 Sample/Result Parameters (params)

....................................................................................................
                                         Optical Parameters
Key    Label                                   Value
ACC    Accessory                               TRANS *010A984F
APR    ATR Pressure                            0
APT    Aperture Setting                        1 mm
BMS    Beamsplitter                            KBr-Broadband
CHN    Measurement Channel                     Sample Compartment
DTC    Detector                                RT-DLaTGS [Internal Pos.1]
HPF    High Pass Filter                        0
LPF    Low Pass Filter                         10.0
LPV    Variable Low Pass Filter (cm-1)         4000
OPF    Optical Filter Setting                  Open
PGN    Preamplifier Gain                       3
RDX    Extended Ready Check                    0
SRC    Source                                  MIR
VEL    Scanner Velocity                        10.0
ADC    External Analog Signals                 0
SON    External Sync                           Off

....................................................................................................
                                    Fourier Transform Parameters
Key    Label                                   Value
APF    Apodization Function                    B3
HFQ    End Frequency Limit for File            500.0
LFQ    Start Frequency Limit for File          10000.0
NLI    Nonlinearity Correction                 0
PHR    Phase Resolution                        100.0
PHZ    Phase Correction Mode                   ML
SPZ    Stored Phase Mode                       NO
ZFF    Zero Filling Factor                     2

....................................................................................................
                                       Acquisition Parameters
Key    Label                                   Value
ADT    Additional Data Treatment               0
AQM    Acquisition Mode                        DD
CFE    Low Intensity Power Mode with DTGS      0
COR    Correlation Test Mode                   0
DEL    Delay Before Measurement                0
DLY    Stabilization Delay                     0
HFW    Wanted High Freq Limit                  15000.0
LFW    Wanted Low Freq Limit                   0.0
NSS    Number of Sample Scans                  50
PLF    Result Spectrum Type                    AB
RES    Resolution (cm-1)                       4.0
SOT    Sample Scans or Time                    0
TCL    Command Line for Additional Data Tr...
TDL    To Do List                              16777271
SGN    Sample Signal Gain                      1

....................................................................................................
                                      Sample Origin Parameters
Key    Label                                   Value
BLD    Building
CNM    Operator Name                           Duran
CPY    Company
DPM    Department
EXP    Experiment                              MWIR-LWIR_Trans_FileNameFormat.XPM
LCT    Location
SFM    Sample Form                             Atm-MWIR (All A)
SNM    Sample Name                             File Test
XPP    Experiment Path                         C:\Users\Public\Documents\Bruker\OPUS_8.1.29\XPM
IST    Instrument Status                       OK
CPG    Character Encoding Code Page            1252
UID    Universally Unique Identifier           0d1348c2-3a2c-41c9-b521-bdaf0a23710c

....................................................................................................
                                    Instrument Status Parameters
Key    Label                                   Value
HFL    High Folding Limit                      15795.820598
LFL    Low Folding Limit                       0.0
LWN    Laser Wavenumber                        15795.820598
ABP    Absolute Peak Pos in Laser*2            52159
SSP    Sample Spacing Divisor                  1
ASG    Actual Signal Gain                      1
ARG    Actual Reference Gain                   1
ASS    Number of Sample Scans                  50
GFW    Number of Good Forward Scans            25
GBW    Number of Good Backward Scans           25
BFW    Number of Bad Forward Scans             0
BBW    Number of Bad Backward Scans            0
PKA    Peak Amplitude                          1409
PKL    Peak Location                           7364
PRA    Backward Peak Amplitude                 1356
PRL    Backward Peak Location                  7363
P2A    Peak Amplitude Channel 2                1
P2L    Peak Location Channel 2                 1
P2R    Backward Peak Amplitude Channel 2       1
P2K    Backward Peak Location Channel 2        1
DAQ    Data Acquisition Status                 0
AG2    Actual Signal Gain Channel 2            1
HUM    Relative Humidity Interferometer        14
SSM    Sample Spacing Multiplier               1
RSN    Running Sample Number                   565
CRR    Correlation Rejection Reason            0
SRT    Start Time (sec)                        1556890484.642
DUR    Duration (sec)                          42.433990478515625
TSC    Scanner Temperature                     27.8
MVD    Max Velocity Deviation                  0.1158025860786438
PRS    Pressure Interferometer (hPa)           1009.9999700000001
AN1    Analog Signal 1                         0.22596596493037535
AN2    Analog Signal 2                         3.459206583321489
VSN    Firmware Version                        2.450 Oct 10 2014
SRN    Instrument Serial Number                1135
CAM    Coaddition Mode                         0
INS    Instrument Type                         VERTEX 80V
FOC    Focal Length                            100.0
RDY    Ready Check                             1

====================================================================================================
                                  Reference Parameters (rf_params)

....................................................................................................
                               Reference Instrument Status Parameters
Key    Label                                   Value
HFL    High Folding Limit                      15795.820598
LFL    Low Folding Limit                       0.0
LWN    Laser Wavenumber                        15795.820598
ABP    Absolute Peak Pos in Laser*2            52159
SSP    Sample Spacing Divisor                  1
ARG    Actual Reference Gain                   1
ASG    Actual Signal Gain                      1
ASS    Number of Sample Scans                  1
GFW    Number of Good Forward Scans            1
GBW    Number of Good Backward Scans           0
BFW    Number of Bad Forward Scans             0
BBW    Number of Bad Backward Scans            0
PKA    Peak Amplitude                          1644
PKL    Peak Location                           7364
PRA    Backward Peak Amplitude                 1
PRL    Backward Peak Location                  -1
P2A    Peak Amplitude Channel 2                1
P2L    Peak Location Channel 2                 1
P2R    Backward Peak Amplitude Channel 2       1
P2K    Backward Peak Location Channel 2        1
DAQ    Data Acquisition Status                 0
AG2    Actual Signal Gain Channel 2            1
HUM    Relative Humidity Interferometer        0
SSM    Sample Spacing Multiplier               1
RSN    Running Sample Number                   5816
CRR    Correlation Rejection Reason            0
SRT    Start Time (sec)                        1556890282.358
DUR    Duration (sec)                          0.7919998168945312
TSC    Scanner Temperature                     27.8
MVD    Max Velocity Deviation                  0.10553144663572311
PRS    Pressure Interferometer (hPa)           2.01999
AN1    Analog Signal 1                         0.22577181458473206
AN2    Analog Signal 2                         4.0960001945495605
VSN    Firmware Version                        2.450 Oct 10 2014
SRN    Instrument Serial Number                1135
CAM    Coaddition Mode                         0
INS    Instrument Type                         VERTEX 80V
FOC    Focal Length                            100.0
RDY    Ready Check                             1
ARS    Number of Reference Scans               1

....................................................................................................
                                    Reference Optical Parameters
Key    Label                                   Value
ACC    Accessory                               TRANS *010A984F
APR    ATR Pressure                            0
APT    Aperture Setting                        1 mm
BMS    Beamsplitter                            KBr-Broadband
DTC    Detector                                RT-DLaTGS [Internal Pos.1]
HPF    High Pass Filter                        0
LPF    Low Pass Filter                         10.0
LPV    Variable Low Pass Filter (cm-1)         4000
OPF    Optical Filter Setting                  Open
PGR    Reference Preamplifier Gain             3
RCH    Reference Measurement Channel           Sample Compartment
RDX    Extended Ready Check                    0
SRC    Source                                  MIR
VEL    Scanner Velocity                        10.0
ADC    External Analog Signals                 0
SON    External Sync                           Off

....................................................................................................
                                  Reference Acquisition Parameters
Key    Label                                   Value
ADT    Additional Data Treatment               0
AQM    Acquisition Mode                        DD
CFE    Low Intensity Power Mode with DTGS      0
COR    Correlation Test Mode                   0
DEL    Delay Before Measurement                0
DLY    Stabilization Delay                     0
HFW    Wanted High Freq Limit                  15000.0
LFW    Wanted Low Freq Limit                   0.0
NSR    Number of Background Scans              1
PLF    Result Spectrum Type                    TR
RES    Resolution (cm-1)                       4.0
RGN    Reference Signal Gain                   1
STR    Scans or Time (Reference)               0
TCL    Command Line for Additional Data Tr...
TDL    To Do List                              16777271

....................................................................................................
                               Reference Fourier Transform Parameters
Key    Label                                   Value
APF    Apodization Function                    B3
HFQ    End Frequency Limit for File            500.0
LFQ    Start Frequency Limit for File          10000.0
NLI    Nonlinearity Correction                 0
PHR    Phase Resolution                        100.0
PHZ    Phase Correction Mode                   ML
SPZ    Stored Phase Mode                       NO
ZFF    Zero Filling Factor                     2

You can access the sample parameters through the OPUSFile.params attribute, or as a direct attribute for shorthand (e.g. OPUSFile.params.apt or OPUSFile.apt). The parameter keys are also case insensitive (e.g. OPUSFile.bms or OPUSFile.BMS).

OPUS files can also contain parameter information about the associated reference (aka background) measurement. These parameters are only accessible through the OPUSFile.rf_params attribute to avoid namespace collisions (e.g. OPUSFile.rf_params.apt).

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

You can also get the human-readable label for a parameter key using the get_param_label function:

from brukeropus.file import get_param_label
data = read_opus('file.0')
print(get_param_label('bms') + ':', data.bms)
print(get_param_label('src') + ':', data.src)
Beamsplitter: KBr-Broadband
Source: MIR

You can also iterate over the parameters using the familiar keys(), values(), and items() functions using the params or rf_params attributes (just like a dictionary):

data = read_opus('file.0')
for key, val in data.params.items():
    print(key + ':', val)
acc: TRANS *010A984F
apr: 0
apt: 1 mm
bms: KBr-Broadband
chn: Sample Compartment
dtc: RT-DLaTGS [Internal Pos.1]
hpf: 0
lpf: 10.0
lpv: 4000
opf: Open
pgn: 3
... continued ...

Data and DataSeries (brukeropus.file.data)

Depending on the settings used to save the OPUS file, different data blocks can be stored. These can include phase, interferograms, single-channel spectra and result spectra (e.g. absorbance, transmittance, etc.). To retrieve a list of the data blocks stored in the OPUS File, you can use the all_data_keys attribute:

data = read_opus('file.0')
print(data.all_data_keys)
['igsm', 'phsm', 'sm', 'a', 'igrf', 'rf']

Each key is also an attribute of the OPUSFile instance that returns either a Data (single spectra) or DataSeries (series of spectra) class. You can use the data_keys attribute to retrieve a list of only the single-spectra Data keys in the class, or the series_keys attribute to retrieve a list of only the DataSeries keys.

You can also iterate over these data keys using the iter_all_data(), iter_data() and iter_series() class methods:

data = read_opus('file.0')
for d in data.iter_data():
    print(d.label, '(' + d.datetime.isoformat(' ') + ')')
Sample Interferogram (2019-05-03 13:34:44.641000)
Sample Phase (2019-05-03 13:34:44.641000)
Sample Spectrum (2019-05-03 13:34:44.641000)
Absorbance (2019-05-03 13:34:44.641000)
Reference Interferogram (2019-05-03 13:31:22.358000)
Reference Spectrum (2019-05-03 13:31:22.358000)

You can access the x and y arrays of a Data or DataSeries class:

data = read_opus('file.0')
plt.plot(data.a.x, data.a.y)  # Plot absorbance
plt.ylim((0, 1))
plt.show()

For spectra with wavenumber as valid unit (e.g. single-channel or result spectra), the x array can be given in wavenumber [cm⁻¹], wavelength [µm], or modulation frequency [Hz] units by using the attributes: wn, wl, or f respectively:

data = read_opus('file.0')
plt.plot(data.sm.wl, data.sm.y)
plt.show()

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

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

Reports (brukeropus.file.report)

OPUS files may also store a variety of reports which typically contain data in tabular format. Because an OPUS file may contain multiple reports, they are stored as a list in the reports attribute (even if only one is available). For OPUS files with no reports, the reports attribute will simply return an empty list. Reports can be printed to the console. As an example of how to access the report data, we will use a Multi-Evaluation Test Report (mev):

data = read_opus(mevfile.0)
print(data.reports[0])
====================================================================================================
                                    Multi Evaluation Test Report
____________________________________________________________________________________________________
         Version: 4
     Method Path: C:\Users\Public\Documents\Bruker\OPUS_8.9.7\ME_Base\ME
     Method Name: IPA Water Int Q1 Q2.mev
Method Date Time: 2025/04/03 17:39:01 (GMT-5)


Multi Evaluation Test Report (table): cols: 6, rows: 4
----------------------------------------------------------------------------------------------------
       Type: Q2  Q2  INT  INT  Q1  Q1
  Subreport: 1   1   2    2    3   3
        Row: 1   2   1    2    1   2
Last Change: 0   0   0    0    0   0
----------------------------------------------------------------------------------------------------
Subreport 0
Quant 2 (table): cols: 2, rows: 35
----------------------------------------------------------------------------------------------------
                  Method_Path: C:\Users\Public\Docume...  C:\Users\Public\Docume...
                  Method_Name: IPA Method.q2              H2O Method.q2
             Date_Time_Method: 2025/04/03 11:50:33 (G...  2025/04/03 11:47:05 (G...
           Date_Time_Analysis: 2025/04/03 21:26:08 (G...  2025/04/03 21:26:09 (G...
                 X_Startpoint: 8920                       9900
                   X_Endpoint: 5396                       6028
               Component_Name: IPA                        H2O
               Component_Unit: %                          %
          Component_Name_User: IPA                        H2O
          Component_Unit_User: %                          %
                   Formatting: %.5G                       %.5G
                   Prediction: -0.0157854                 100.162
           Prediction_Outside: 1                          1
        Prediction_Calculated: -0.0157854                 100.162
Prediction_Calculated_Outside: 0                          0
                      Formula:
                External_Bias: 3.40282e+38                3.40282e+38
         Target_Concentration: 3.40282e+38                3.40282e+38
          Warning_Upper_Limit: 3.40282e+38                3.40282e+38
          Warning_Lower_Limit: 3.40282e+38                3.40282e+38
            Alarm_Upper_Limit: 3.40282e+38                3.40282e+38
            Alarm_Lower_Limit: 3.40282e+38                3.40282e+38
                     Mah_Dist: 0.281401                   0.330205
               Mah_Dist_Limit: 0.569619                   0.717409
     Mah_Dist_Limit_By_Factor: 0.569619                   0.717409
             Mah_Dist_Outlier: 0                          0
                          MDI: 0.494015                   0.460275
                Spec_Residual: 0.000657344                0.000157652
                      F_Value: 1.78523                    0.977421
                       F_Prob: 0.801844                   0.664059
                 F_Prob_Limit: 0.99                       0.99
        Spec_Residual_Outlier: 0                          0
      Component_Value_Density: 3.40282e+38                3.40282e+38
Component_Value_Density_Limit: 3.40282e+38                3.40282e+38
         Process_Channel_Name:
----------------------------------------------------------------------------------------------------
Subreport 1
Integration (table): cols: 2, rows: 25
----------------------------------------------------------------------------------------------------
                  Method_Path: C:\Users\Public\Docume...  C:\Users\Public\Docume...
                  Method_Name: Water Integration.int      IPA Integration.int
             Date_Time_Method: 2025/04/03 12:49:06 (G...  2025/04/03 12:45:18 (G...
           Date_Time_Analysis: 2025/04/03 21:26:09 (G...  2025/04/03 21:26:09 (G...
                 X_Startpoint: 8127.6                     5970.95
                   X_Endpoint: 7368.4                     5874.2
                        Label: H2O                        IPA
                   Label_User: H2O                        IPA
                         Type: B                          B
                   Formatting: %.6G                       %.6G
           Integration_Result: -155.238                   -0.918539
Integration_Result_Calculated: -155.238                   -0.918539
                      Formula:
                       Freq_1: 8127.6                     5970.95
                       Freq_2: 7368.4                     5874.2
                       Freq_3: 1.001e-199                 1.001e-199
                       Freq_4: 1.001e-199                 1.001e-199
                       Freq_5: 1.001e-199                 1.001e-199
                       Freq_6: 1.001e-199                 1.001e-199
         Target_Concentration: 3.40282e+38                3.40282e+38
          Warning_Upper_Limit: 3.40282e+38                3.40282e+38
          Warning_Lower_Limit: 3.40282e+38                3.40282e+38
            Alarm_Upper_Limit: 3.40282e+38                3.40282e+38
            Alarm_Lower_Limit: 3.40282e+38                3.40282e+38
         Process_Channel_Name:
----------------------------------------------------------------------------------------------------
Subreport 2
Quant 1 (table): cols: 2, rows: 22
----------------------------------------------------------------------------------------------------
          Method_Path: C:\Users\Public\Docume...  C:\Users\Public\Docume...
          Method_Name: Water Quant 1_Linear.q1    IPA Quant 1_Linear.q1
     Date_Time_Method: 2025/04/03 12:48:16 (G...  2025/04/03 09:03:49 (G...
   Date_Time_Analysis: 2025/04/03 21:26:09 (G...  2025/04/03 21:26:09 (G...
         X_Startpoint: 7368.4                     5874.2
           X_Endpoint: 8127.6                     5970.95
       Component_Name: Water                      IPA
       Component_Unit: %                          %
  Component_Name_User: Water                      IPA
  Component_Unit_User: %                          %
           Formatting: %.4G                       %.4G
           Prediction: 86.3654                    -7.54551
Prediction_Calculated: 86.3654                    -7.54551
              Formula:
                Sigma: 9.65275                    10.7219
   Integration_Result: 159.336                    135.308
 Target_Concentration: 3.40282e+38                3.40282e+38
  Warning_Upper_Limit: 3.40282e+38                3.40282e+38
  Warning_Lower_Limit: 3.40282e+38                3.40282e+38
    Alarm_Upper_Limit: 3.40282e+38                3.40282e+38
    Alarm_Lower_Limit: 3.40282e+38                3.40282e+38
 Process_Channel_Name:
----------------------------------------------------------------------------------------------------
====================================================================================================

At the very top of the report, you see a centered title. This title can be accessed by the title attribute of the Report.

report = data.reports[0]
print(report.title)
Multi Evaluation Test Report

After the title, you see a list of report properties. These properties are stored as a dict in the properties attribute of a Report, but can also be accessed by indexing the report using the property key (case insensitive):

for key, val in report.properties.items():
    print(key, val)
print('\nAccessing report properties by name:')
print(report['Method Name'], report['Method Name'] == report['method name'])
Version 4
Method Path C:\Users\Public\Documents\Bruker\OPUS_8.9.7\ME_Base\ME
Method Name IPA Water Int Q1 Q2.mev
Method Date Time 2025/04/03 17:39:01 (GMT-5)

Accessing report properties by name:
IPA Water Int Q1 Q2.mev True

Following the report properties is a table. This data is stored in the table attribute of a Report as a ReportTable class (brukeropus.file.report.ReportTable). ReportTables have titles, headers, and values. Below is a snippet showing how to access data from the report table:

print('Table title:', report.table.title)
print('Table Headers:', report.table.header)
print('Table row values by name:', report.table['Type'])
print('Table row values by index:', report.table[1])
print('Last value of a table row:', report.table['Type'][-1])
Table title: Multi Evaluation Test Report
Table Headers: ['Type', 'Subreport', 'Row', 'Last Change']
Table row values by name: ['Q2', 'Q2', 'INT', 'INT', 'Q1', 'Q1']
Table row values by index: [1, 1, 2, 2, 3, 3]
Last value of a table row: Q1

In this report, the table is followed by a series of subreports. Because a report can have multiple subreports (this file has 3), they are stored as a list in the sub attribute of a Report. Subreports can be accessed by indexing the sub attribute, or directly indexing the Report. Because these subreports are ReportTables, they have the same interface as above:

print('First subreport title:', report.sub[0].title)
print('Second subreport title:', report[1].title)
print('First subreport Method Names:', report[0]['method_name'])
print('First method name of the first subreport:', report[0]['method_name'][0])
First subreport title: Quant 2
Second subreport title: Integration
First subreport Method Names: ['IPA Method.q2', 'H2O Method.q2']
First method name of the first subreport: IPA Method.q2
  1'''
  2The `brukeropus.file` submodule of `brukeropus` includes all the functions and classes for reading and exploring OPUS
  3files. This includes both high-level functions like `read_opus` that returns an `OPUSFile` class, as well as low-level
  4parsing functions like `parse_directory` that returns data extracted directly from the binary OPUS file bytes.  This
  5overview documentation will focus on the high-level functions which will be useful for most users.  If you are
  6interested in using the low-level parsing functions, perhaps to make your own data class or customize how files are
  7read, refer to: `brukeropus.file.parse` which contains all the low-level parsing functions.
  8## Finding OPUS Files
  9OPUS files are typically saved with a numeric file extension (e.g. file.0, file.1, file.1001).  This makes searching for
 10a list of OPUS files in a directory a little more cumbersome than a traditional "*.csv" search.  To address this,
 11`brukeropus` includes a `find_opus_files` function:
 12```python
 13from brukeropus import find_opus_files
 14
 15filepaths = find_opus_files(r'path\\to\\opus\\files', recursive=True)
 16```
 17Which will assign a list of filepaths that match the numeric extension formatting of OPUS files. For full documentation,
 18see `brukeropus.file.utils.find_opus_files`.
 19## Reading OPUS Files
 20`brukeropus` parses OPUS files and assembles them into an `OPUSFile` object that contains the extracted data (and
 21metadata) within the file.  You can generate an `OPUSFile` object in one of two ways:
 22```python
 23from brukeropus import read_opus, OPUSFile
 24
 25filepath = r'path\\to\\opusfile.0'
 26
 27data = read_opus(filepath)
 28same_data = OPUSFile(filepath)
 29```
 30In the above code, `data` and `same_data` are both `OPUSFile` objects with identical data.
 31## Using the `OPUSFile` Class
 32OPUS files all start with the same first four *magic bytes*.  If the file does not start with these bytes (i.e. is not
 33a valid OPUS file), the `OPUSFile` class will logically evaluate to `false`:
 34```python
 35data = read_opus('file.pdf')
 36if data:
 37    print(data)
 38else:
 39    print(data.filepath, 'is not an OPUS file')
 40```
 41The `OPUSFile` class provides an interface for accessing the data (stored as blocks) in an OPUS file.  Accessible data
 42includes:
 43
 44**Parameters** (`brukeropus.file.params`): measurement metadata
 45
 46**Data** (`brukeropus.file.data.Data`): measurements spectra (1D)
 47
 48**DataSeries** (`brukeropus.file.data.DataSeries`): series of measurements spectra (3D)
 49
 50**Report** (`brukeropus.file.report`): tabular report info (e.g. multi-evaluation test reports)
 51
 52To view a quick summary of the data contained in an `OPUSFile` instance, simply print it to the console:
 53
 54```python
 55data = read_opus('file.0')
 56print(data)
 57```
 58```console
 59========================================================================================================================
 60                                                 OPUS File: file.0
 61Attribute      Class type          Description
 62――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
 63params         Parameters          Optical, Fourier Transform, Acquisition, Sample Origin, Instrument Status Parameters
 64rf_params      Parameters          Instrument Status, Optical, Acquisition, Fourier Transform Reference Parameters
 65rf             Data                Reference Spectrum
 66igrf           Data                Reference Interferogram
 67a              Data                Absorbance
 68sm             Data                Sample Spectrum
 69phsm           Data                Sample Phase
 70igsm           Data                Sample Interferogram
 71history        str                 History log of file
 72――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
 73```
 74The output listed here will depend on what data blocks were saved in the OPUS file.  The following sections will go
 75over the various data class types in more detail.
 76
 77###Parameters (brukeropus.file.params.Parameters)
 78
 79The metadata in an OPUS file is stored in  `Parameters` classes.  These classes can be stored in the `params` and
 80`rf_params` attributes which contain the sample and reference parameter metadata respectively.
 81
 82To view all parameter metadata in the file, you can print to the console using the class method: `print_parameters`.
 83This will let you view all the key, value parameter data extracted from the file with labels for what the parameter keys
 84are referring to wherever known.
 85
 86```python
 87data = read_opus('file.0')
 88data.print_parameters()
 89```
 90<details>
 91<summary>Example `print_parameters` Output</summary>
 92<p>
 93```console
 94====================================================================================================
 95                                 Sample/Result Parameters (params)
 96
 97....................................................................................................
 98                                         Optical Parameters
 99Key    Label                                   Value
100ACC    Accessory                               TRANS *010A984F
101APR    ATR Pressure                            0
102APT    Aperture Setting                        1 mm
103BMS    Beamsplitter                            KBr-Broadband
104CHN    Measurement Channel                     Sample Compartment
105DTC    Detector                                RT-DLaTGS [Internal Pos.1]
106HPF    High Pass Filter                        0
107LPF    Low Pass Filter                         10.0
108LPV    Variable Low Pass Filter (cm-1)         4000
109OPF    Optical Filter Setting                  Open
110PGN    Preamplifier Gain                       3
111RDX    Extended Ready Check                    0
112SRC    Source                                  MIR
113VEL    Scanner Velocity                        10.0
114ADC    External Analog Signals                 0
115SON    External Sync                           Off
116
117....................................................................................................
118                                    Fourier Transform Parameters
119Key    Label                                   Value
120APF    Apodization Function                    B3
121HFQ    End Frequency Limit for File            500.0
122LFQ    Start Frequency Limit for File          10000.0
123NLI    Nonlinearity Correction                 0
124PHR    Phase Resolution                        100.0
125PHZ    Phase Correction Mode                   ML
126SPZ    Stored Phase Mode                       NO
127ZFF    Zero Filling Factor                     2
128
129....................................................................................................
130                                       Acquisition Parameters
131Key    Label                                   Value
132ADT    Additional Data Treatment               0
133AQM    Acquisition Mode                        DD
134CFE    Low Intensity Power Mode with DTGS      0
135COR    Correlation Test Mode                   0
136DEL    Delay Before Measurement                0
137DLY    Stabilization Delay                     0
138HFW    Wanted High Freq Limit                  15000.0
139LFW    Wanted Low Freq Limit                   0.0
140NSS    Number of Sample Scans                  50
141PLF    Result Spectrum Type                    AB
142RES    Resolution (cm-1)                       4.0
143SOT    Sample Scans or Time                    0
144TCL    Command Line for Additional Data Tr...
145TDL    To Do List                              16777271
146SGN    Sample Signal Gain                      1
147
148....................................................................................................
149                                      Sample Origin Parameters
150Key    Label                                   Value
151BLD    Building
152CNM    Operator Name                           Duran
153CPY    Company
154DPM    Department
155EXP    Experiment                              MWIR-LWIR_Trans_FileNameFormat.XPM
156LCT    Location
157SFM    Sample Form                             Atm-MWIR (All A)
158SNM    Sample Name                             File Test
159XPP    Experiment Path                         C:\\Users\\Public\\Documents\\Bruker\\OPUS_8.1.29\\XPM
160IST    Instrument Status                       OK
161CPG    Character Encoding Code Page            1252
162UID    Universally Unique Identifier           0d1348c2-3a2c-41c9-b521-bdaf0a23710c
163
164....................................................................................................
165                                    Instrument Status Parameters
166Key    Label                                   Value
167HFL    High Folding Limit                      15795.820598
168LFL    Low Folding Limit                       0.0
169LWN    Laser Wavenumber                        15795.820598
170ABP    Absolute Peak Pos in Laser*2            52159
171SSP    Sample Spacing Divisor                  1
172ASG    Actual Signal Gain                      1
173ARG    Actual Reference Gain                   1
174ASS    Number of Sample Scans                  50
175GFW    Number of Good Forward Scans            25
176GBW    Number of Good Backward Scans           25
177BFW    Number of Bad Forward Scans             0
178BBW    Number of Bad Backward Scans            0
179PKA    Peak Amplitude                          1409
180PKL    Peak Location                           7364
181PRA    Backward Peak Amplitude                 1356
182PRL    Backward Peak Location                  7363
183P2A    Peak Amplitude Channel 2                1
184P2L    Peak Location Channel 2                 1
185P2R    Backward Peak Amplitude Channel 2       1
186P2K    Backward Peak Location Channel 2        1
187DAQ    Data Acquisition Status                 0
188AG2    Actual Signal Gain Channel 2            1
189HUM    Relative Humidity Interferometer        14
190SSM    Sample Spacing Multiplier               1
191RSN    Running Sample Number                   565
192CRR    Correlation Rejection Reason            0
193SRT    Start Time (sec)                        1556890484.642
194DUR    Duration (sec)                          42.433990478515625
195TSC    Scanner Temperature                     27.8
196MVD    Max Velocity Deviation                  0.1158025860786438
197PRS    Pressure Interferometer (hPa)           1009.9999700000001
198AN1    Analog Signal 1                         0.22596596493037535
199AN2    Analog Signal 2                         3.459206583321489
200VSN    Firmware Version                        2.450 Oct 10 2014
201SRN    Instrument Serial Number                1135
202CAM    Coaddition Mode                         0
203INS    Instrument Type                         VERTEX 80V
204FOC    Focal Length                            100.0
205RDY    Ready Check                             1
206
207====================================================================================================
208                                  Reference Parameters (rf_params)
209
210....................................................................................................
211                               Reference Instrument Status Parameters
212Key    Label                                   Value
213HFL    High Folding Limit                      15795.820598
214LFL    Low Folding Limit                       0.0
215LWN    Laser Wavenumber                        15795.820598
216ABP    Absolute Peak Pos in Laser*2            52159
217SSP    Sample Spacing Divisor                  1
218ARG    Actual Reference Gain                   1
219ASG    Actual Signal Gain                      1
220ASS    Number of Sample Scans                  1
221GFW    Number of Good Forward Scans            1
222GBW    Number of Good Backward Scans           0
223BFW    Number of Bad Forward Scans             0
224BBW    Number of Bad Backward Scans            0
225PKA    Peak Amplitude                          1644
226PKL    Peak Location                           7364
227PRA    Backward Peak Amplitude                 1
228PRL    Backward Peak Location                  -1
229P2A    Peak Amplitude Channel 2                1
230P2L    Peak Location Channel 2                 1
231P2R    Backward Peak Amplitude Channel 2       1
232P2K    Backward Peak Location Channel 2        1
233DAQ    Data Acquisition Status                 0
234AG2    Actual Signal Gain Channel 2            1
235HUM    Relative Humidity Interferometer        0
236SSM    Sample Spacing Multiplier               1
237RSN    Running Sample Number                   5816
238CRR    Correlation Rejection Reason            0
239SRT    Start Time (sec)                        1556890282.358
240DUR    Duration (sec)                          0.7919998168945312
241TSC    Scanner Temperature                     27.8
242MVD    Max Velocity Deviation                  0.10553144663572311
243PRS    Pressure Interferometer (hPa)           2.01999
244AN1    Analog Signal 1                         0.22577181458473206
245AN2    Analog Signal 2                         4.0960001945495605
246VSN    Firmware Version                        2.450 Oct 10 2014
247SRN    Instrument Serial Number                1135
248CAM    Coaddition Mode                         0
249INS    Instrument Type                         VERTEX 80V
250FOC    Focal Length                            100.0
251RDY    Ready Check                             1
252ARS    Number of Reference Scans               1
253
254....................................................................................................
255                                    Reference Optical Parameters
256Key    Label                                   Value
257ACC    Accessory                               TRANS *010A984F
258APR    ATR Pressure                            0
259APT    Aperture Setting                        1 mm
260BMS    Beamsplitter                            KBr-Broadband
261DTC    Detector                                RT-DLaTGS [Internal Pos.1]
262HPF    High Pass Filter                        0
263LPF    Low Pass Filter                         10.0
264LPV    Variable Low Pass Filter (cm-1)         4000
265OPF    Optical Filter Setting                  Open
266PGR    Reference Preamplifier Gain             3
267RCH    Reference Measurement Channel           Sample Compartment
268RDX    Extended Ready Check                    0
269SRC    Source                                  MIR
270VEL    Scanner Velocity                        10.0
271ADC    External Analog Signals                 0
272SON    External Sync                           Off
273
274....................................................................................................
275                                  Reference Acquisition Parameters
276Key    Label                                   Value
277ADT    Additional Data Treatment               0
278AQM    Acquisition Mode                        DD
279CFE    Low Intensity Power Mode with DTGS      0
280COR    Correlation Test Mode                   0
281DEL    Delay Before Measurement                0
282DLY    Stabilization Delay                     0
283HFW    Wanted High Freq Limit                  15000.0
284LFW    Wanted Low Freq Limit                   0.0
285NSR    Number of Background Scans              1
286PLF    Result Spectrum Type                    TR
287RES    Resolution (cm-1)                       4.0
288RGN    Reference Signal Gain                   1
289STR    Scans or Time (Reference)               0
290TCL    Command Line for Additional Data Tr...
291TDL    To Do List                              16777271
292
293....................................................................................................
294                               Reference Fourier Transform Parameters
295Key    Label                                   Value
296APF    Apodization Function                    B3
297HFQ    End Frequency Limit for File            500.0
298LFQ    Start Frequency Limit for File          10000.0
299NLI    Nonlinearity Correction                 0
300PHR    Phase Resolution                        100.0
301PHZ    Phase Correction Mode                   ML
302SPZ    Stored Phase Mode                       NO
303ZFF    Zero Filling Factor                     2
304```
305</p>
306</details>
307
308You can access the sample parameters through the `OPUSFile.params` attribute, or as a direct attribute for shorthand
309(e.g. `OPUSFile.params.apt` or `OPUSFile.apt`).  The parameter keys are also case insensitive (e.g. `OPUSFile.bms` or
310`OPUSFile.BMS`).
311
312OPUS files can also contain parameter information about the associated reference (aka background) measurement. These
313parameters are only accessible through the `OPUSFile.rf_params` attribute to avoid namespace collisions (e.g.
314`OPUSFile.rf_params.apt`).
315
316```python
317data = read_opus('file.0')
318print('Sample ZFF:', data.zff, 'Reference ZFF:', data.rf_params.zff)
319```
320```console
321Sample ZFF: 2 Reference ZFF: 2
322```
323
324You can also get the human-readable label for a parameter key using the `get_param_label` function:
325
326```python
327from brukeropus.file import get_param_label
328data = read_opus('file.0')
329print(get_param_label('bms') + ':', data.bms)
330print(get_param_label('src') + ':', data.src)
331```
332```console
333Beamsplitter: KBr-Broadband
334Source: MIR
335```
336
337You can also iterate over the parameters using the familiar `keys()`, `values()`, and `items()` functions using the
338`params` or `rf_params` attributes (just like a dictionary):
339
340```python
341data = read_opus('file.0')
342for key, val in data.params.items():
343    print(key + ':', val)
344```
345```console
346acc: TRANS *010A984F
347apr: 0
348apt: 1 mm
349bms: KBr-Broadband
350chn: Sample Compartment
351dtc: RT-DLaTGS [Internal Pos.1]
352hpf: 0
353lpf: 10.0
354lpv: 4000
355opf: Open
356pgn: 3
357... continued ...
358```
359
360###Data and DataSeries (brukeropus.file.data)
361
362Depending on the settings used to save the OPUS file, different data blocks can be stored. These can include phase,
363interferograms, single-channel spectra and result spectra (e.g. absorbance, transmittance, etc.). To retrieve a list of
364the data blocks stored in the OPUS File, you can use the `all_data_keys` attribute:
365
366```python
367data = read_opus('file.0')
368print(data.all_data_keys)
369```
370```console
371['igsm', 'phsm', 'sm', 'a', 'igrf', 'rf']
372```
373
374Each key is also an attribute of the `OPUSFile` instance that returns either a `Data` (single spectra) or `DataSeries`
375(series of spectra) class.  You can use the `data_keys` attribute to retrieve a list of only the single-spectra `Data`
376keys in the class, or the `series_keys` attribute to retrieve a list of only the `DataSeries` keys.
377
378You can also iterate over these data keys using the `iter_all_data()`, `iter_data()` and `iter_series()` class
379methods:
380
381```python
382data = read_opus('file.0')
383for d in data.iter_data():
384    print(d.label, '(' + d.datetime.isoformat(' ') + ')')
385```
386```console
387Sample Interferogram (2019-05-03 13:34:44.641000)
388Sample Phase (2019-05-03 13:34:44.641000)
389Sample Spectrum (2019-05-03 13:34:44.641000)
390Absorbance (2019-05-03 13:34:44.641000)
391Reference Interferogram (2019-05-03 13:31:22.358000)
392Reference Spectrum (2019-05-03 13:31:22.358000)
393```
394
395You can access the `x` and `y` arrays of a `Data` or `DataSeries` class:
396
397```python
398data = read_opus('file.0')
399plt.plot(data.a.x, data.a.y)  # Plot absorbance
400plt.ylim((0, 1))
401plt.show()
402```
403
404For spectra with wavenumber as valid unit (e.g. single-channel or result spectra), the `x` array can be given in
405wavenumber [`cm⁻¹`], wavelength [`µm`], or modulation frequency [`Hz`] units by using the attributes: `wn`, `wl`, or `f`
406respectively:
407
408```python
409data = read_opus('file.0')
410plt.plot(data.sm.wl, data.sm.y)
411plt.show()
412```
413
414Each data block in an OPUS file also contains a small parameter block with information such as the min/max y-value
415(mny, mxy), x-units (dxu), number of data points (npt), etc.  These can be accessed as direct attributes to the `Data`
416class, or through the `Data.params` attribute:
417
418```python
419data = read_opus('file.0')
420print('Sample spectra y-min:', data.sm.mny, 'y-max:', data.sm.mxy)
421```
422```console
423Sample spectra y-min: 1.2147593224653974e-05 y-max: 0.03543896973133087
424```
425
426###Reports (brukeropus.file.report)
427
428OPUS files may also store a variety of reports which typically contain data in tabular format.  Because an OPUS file may
429contain multiple reports, they are stored as a `list` in the `reports` attribute (even if only one is available). For
430OPUS files with no reports, the `reports` attribute will simply return an empty list.  Reports can be printed to the
431console.  As an example of how to access the report data, we will use a Multi-Evaluation Test Report (mev):
432
433```python
434data = read_opus(mevfile.0)
435print(data.reports[0])
436```
437
438```console
439====================================================================================================
440                                    Multi Evaluation Test Report
441____________________________________________________________________________________________________
442         Version: 4
443     Method Path: C:\\Users\\Public\\Documents\\Bruker\\OPUS_8.9.7\\ME_Base\ME
444     Method Name: IPA Water Int Q1 Q2.mev
445Method Date Time: 2025/04/03 17:39:01 (GMT-5)
446
447
448Multi Evaluation Test Report (table): cols: 6, rows: 4
449----------------------------------------------------------------------------------------------------
450       Type: Q2  Q2  INT  INT  Q1  Q1
451  Subreport: 1   1   2    2    3   3
452        Row: 1   2   1    2    1   2
453Last Change: 0   0   0    0    0   0
454----------------------------------------------------------------------------------------------------
455Subreport 0
456Quant 2 (table): cols: 2, rows: 35
457----------------------------------------------------------------------------------------------------
458                  Method_Path: C:\\Users\\Public\\Docume...  C:\\Users\\Public\\Docume...
459                  Method_Name: IPA Method.q2              H2O Method.q2
460             Date_Time_Method: 2025/04/03 11:50:33 (G...  2025/04/03 11:47:05 (G...
461           Date_Time_Analysis: 2025/04/03 21:26:08 (G...  2025/04/03 21:26:09 (G...
462                 X_Startpoint: 8920                       9900
463                   X_Endpoint: 5396                       6028
464               Component_Name: IPA                        H2O
465               Component_Unit: %                          %
466          Component_Name_User: IPA                        H2O
467          Component_Unit_User: %                          %
468                   Formatting: %.5G                       %.5G
469                   Prediction: -0.0157854                 100.162
470           Prediction_Outside: 1                          1
471        Prediction_Calculated: -0.0157854                 100.162
472Prediction_Calculated_Outside: 0                          0
473                      Formula:
474                External_Bias: 3.40282e+38                3.40282e+38
475         Target_Concentration: 3.40282e+38                3.40282e+38
476          Warning_Upper_Limit: 3.40282e+38                3.40282e+38
477          Warning_Lower_Limit: 3.40282e+38                3.40282e+38
478            Alarm_Upper_Limit: 3.40282e+38                3.40282e+38
479            Alarm_Lower_Limit: 3.40282e+38                3.40282e+38
480                     Mah_Dist: 0.281401                   0.330205
481               Mah_Dist_Limit: 0.569619                   0.717409
482     Mah_Dist_Limit_By_Factor: 0.569619                   0.717409
483             Mah_Dist_Outlier: 0                          0
484                          MDI: 0.494015                   0.460275
485                Spec_Residual: 0.000657344                0.000157652
486                      F_Value: 1.78523                    0.977421
487                       F_Prob: 0.801844                   0.664059
488                 F_Prob_Limit: 0.99                       0.99
489        Spec_Residual_Outlier: 0                          0
490      Component_Value_Density: 3.40282e+38                3.40282e+38
491Component_Value_Density_Limit: 3.40282e+38                3.40282e+38
492         Process_Channel_Name:
493----------------------------------------------------------------------------------------------------
494Subreport 1
495Integration (table): cols: 2, rows: 25
496----------------------------------------------------------------------------------------------------
497                  Method_Path: C:\\Users\\Public\\Docume...  C:\\Users\\Public\\Docume...
498                  Method_Name: Water Integration.int      IPA Integration.int
499             Date_Time_Method: 2025/04/03 12:49:06 (G...  2025/04/03 12:45:18 (G...
500           Date_Time_Analysis: 2025/04/03 21:26:09 (G...  2025/04/03 21:26:09 (G...
501                 X_Startpoint: 8127.6                     5970.95
502                   X_Endpoint: 7368.4                     5874.2
503                        Label: H2O                        IPA
504                   Label_User: H2O                        IPA
505                         Type: B                          B
506                   Formatting: %.6G                       %.6G
507           Integration_Result: -155.238                   -0.918539
508Integration_Result_Calculated: -155.238                   -0.918539
509                      Formula:
510                       Freq_1: 8127.6                     5970.95
511                       Freq_2: 7368.4                     5874.2
512                       Freq_3: 1.001e-199                 1.001e-199
513                       Freq_4: 1.001e-199                 1.001e-199
514                       Freq_5: 1.001e-199                 1.001e-199
515                       Freq_6: 1.001e-199                 1.001e-199
516         Target_Concentration: 3.40282e+38                3.40282e+38
517          Warning_Upper_Limit: 3.40282e+38                3.40282e+38
518          Warning_Lower_Limit: 3.40282e+38                3.40282e+38
519            Alarm_Upper_Limit: 3.40282e+38                3.40282e+38
520            Alarm_Lower_Limit: 3.40282e+38                3.40282e+38
521         Process_Channel_Name:
522----------------------------------------------------------------------------------------------------
523Subreport 2
524Quant 1 (table): cols: 2, rows: 22
525----------------------------------------------------------------------------------------------------
526          Method_Path: C:\\Users\\Public\\Docume...  C:\\Users\\Public\\Docume...
527          Method_Name: Water Quant 1_Linear.q1    IPA Quant 1_Linear.q1
528     Date_Time_Method: 2025/04/03 12:48:16 (G...  2025/04/03 09:03:49 (G...
529   Date_Time_Analysis: 2025/04/03 21:26:09 (G...  2025/04/03 21:26:09 (G...
530         X_Startpoint: 7368.4                     5874.2
531           X_Endpoint: 8127.6                     5970.95
532       Component_Name: Water                      IPA
533       Component_Unit: %                          %
534  Component_Name_User: Water                      IPA
535  Component_Unit_User: %                          %
536           Formatting: %.4G                       %.4G
537           Prediction: 86.3654                    -7.54551
538Prediction_Calculated: 86.3654                    -7.54551
539              Formula:
540                Sigma: 9.65275                    10.7219
541   Integration_Result: 159.336                    135.308
542 Target_Concentration: 3.40282e+38                3.40282e+38
543  Warning_Upper_Limit: 3.40282e+38                3.40282e+38
544  Warning_Lower_Limit: 3.40282e+38                3.40282e+38
545    Alarm_Upper_Limit: 3.40282e+38                3.40282e+38
546    Alarm_Lower_Limit: 3.40282e+38                3.40282e+38
547 Process_Channel_Name:
548----------------------------------------------------------------------------------------------------
549====================================================================================================
550```
551
552At the very top of the report, you see a centered title.  This title can be accessed by the `title`
553attribute of the `Report`.
554
555```python
556report = data.reports[0]
557print(report.title)
558```
559```console
560Multi Evaluation Test Report
561```
562
563After the title, you see a list of report properties.  These properties are stored as a `dict` in
564the `properties` attribute of a `Report`, but can also be accessed by indexing the report using the
565property key (case insensitive):
566```python
567for key, val in report.properties.items():
568    print(key, val)
569print('\\nAccessing report properties by name:')
570print(report['Method Name'], report['Method Name'] == report['method name'])
571```
572```console
573Version 4
574Method Path C:\\Users\\Public\\Documents\\Bruker\\OPUS_8.9.7\\ME_Base\\ME
575Method Name IPA Water Int Q1 Q2.mev
576Method Date Time 2025/04/03 17:39:01 (GMT-5)
577
578Accessing report properties by name:
579IPA Water Int Q1 Q2.mev True
580```
581
582Following the report properties is a table.  This data is stored in the `table` attribute of a 
583`Report` as a `ReportTable` class (`brukeropus.file.report.ReportTable`).  `ReportTable`s have
584titles, headers, and values.  Below is a snippet showing how to access data from the report table:
585
586```python
587print('Table title:', report.table.title)
588print('Table Headers:', report.table.header)
589print('Table row values by name:', report.table['Type'])
590print('Table row values by index:', report.table[1])
591print('Last value of a table row:', report.table['Type'][-1])
592```
593```console
594Table title: Multi Evaluation Test Report
595Table Headers: ['Type', 'Subreport', 'Row', 'Last Change']
596Table row values by name: ['Q2', 'Q2', 'INT', 'INT', 'Q1', 'Q1']
597Table row values by index: [1, 1, 2, 2, 3, 3]
598Last value of a table row: Q1
599```
600
601In this report, the table is followed by a series of subreports.  Because a report can have multiple
602subreports (this file has 3), they are stored as a `list` in the `sub` attribute of a `Report`.
603Subreports can be accessed by indexing the `sub` attribute, or directly indexing the `Report`.
604Because these subreports are `ReportTable`s, they have the same interface as above:
605
606```python
607print('First subreport title:', report.sub[0].title)
608print('Second subreport title:', report[1].title)
609print('First subreport Method Names:', report[0]['method_name'])
610print('First method name of the first subreport:', report[0]['method_name'][0])
611```
612```console
613First subreport title: Quant 2
614Second subreport title: Integration
615First subreport Method Names: ['IPA Method.q2', 'H2O Method.q2']
616First method name of the first subreport: IPA Method.q2
617```
618'''
619
620from brukeropus.file.block import *
621from brukeropus.file.constants import *
622from brukeropus.file.data import *
623from brukeropus.file.directory import *
624from brukeropus.file.file import *
625from brukeropus.file.labels import *
626from brukeropus.file.params import *
627from brukeropus.file.parse import *
628from brukeropus.file.report import *
629from brukeropus.file.utils import *