# MOMA Mass Calibration

This page details how mass calibration is accomplished for MOMA\'s mass
spectrometer. The mass calibration config file is currently being used
by MOMA Data View, our python tools, and XINA Online.

## Mass Cal Config File Format 

### All Versions 

#### Conventions

-   Any line that starts with \'#\' should be treated as a comment and
    ignored

#### Fields

-   **version** - The version that this config file\'s format adheres to

### Version 1 

#### Fields 

-   **control_mode** - Defines the control mode that the data was
    calibrated with. The mapping is as follows:

```
 0 = BIN
 1 = RF_MON
 2 = RF_DAC
```

-   **entries** - Each entry defines a mass calibration. Entries are
    unique by their phase_cycle. A scan\'s phase cycle should be used to
    determine which mass calibration is applied.
-   **constants** - The constants/coefficients for the mass transform
    polynomial. index 0 is the constant and so forth. Example:

` [1.0, 2.0, 3.0] --> m/z = 3x^2 + 2x + 1`

-   **order** - The polynomials order
-   **data_points** - The data points that were used to generate the
    curve fit. The control value is manually selected and mapped to a
    mass to achieve the necessary mass calibration.
-   **rms** - The root mean square of the curve fit to the data_points
-   **phase_cycle** - The phase cycle for this calibration entry. You
    should use a scan\'s phase cycle to determine which calibration is
    applied.

#### Example

```json
{  
  "control_mode":2,
  "entries":[  
     {  
        "constants":[  
           0.0,
           1.0,
           0.0
        ],
        "data_points":[  
        ],
        "order":0,
        "phase_cycle":-1,
        "rms":0.0
     },
     {  
        "constants":[  
           3.04691,
           0.568583,
           0.0
        ],
        "data_points":[  
           {  
              "amu":132.905,
              "control":228.389
           },
           {  
              "amu":392.715,
              "control":685.332
           }
        ],
        "order":1,
        "phase_cycle":3,
        "rms":1.0
     },
     {  
        "constants":[  
           6.34889,
           0.992971,
           0.0
        ],
        "data_points":[  
           {  
              "amu":132.905,
              "control":127.214
           },
           {  
              "amu":392.715,
              "control":389.253
           },
           {  
              "amu":652.525,
              "control":651.162
           },
           {  
              "amu":912.335,
              "control":912.074
           }
        ],
        "order":1,
        "phase_cycle":6,
        "rms":0.999999
     }
  ],
  "version":2
}
```