DeepSOIC / mass-decomposer

Process mass-spectrum mass signals into molecule signals

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mass-decomposer

python script for processing mass-spectrum mass signals into molecule signals.

Takes as input:

  • list of molecules and peak magnitudes for each molecule
  • datalogged file with columns corresponding to recorded magnitude of each peak

Outputs:

  • magnitudes of molecules to match the input peaks (least-squares fit, independently for each data row)
  • residual data
  • inverse matrix
  • matrix condition value

how to use

instructions are for Windows.

  1. First of all, install python with numpy. You must be able to type python to cmd to launch python interpreter (i.e., python.exe must be in a directory listed in PATH environment variable).
Detais: (click to expand)

a. download python here: https://www.python.org/downloads/
Install it. Tick "add python to Path" when installing.

b. open command prompt. Type:

python -m pip install --user numpy

  1. Edit MassDecomposerScript.py to contain your list of molecules, and mass-spectrum peak magnitudes. Hint: if you copy the file to your data directory and edit it there, it will be picked up instead of the default one.
molecs = [
    ('NO', {
        'm29Int': 0.021892103,
        'm30Int': 0.072973677,
        'm31Int': 0.905134219,
    }),
    ('CO', {
        'm28Int': 0.436291522,
        'm29Int': 0.498264750,
        'm30Int': 0.058254834,
        'm31Int': 0.007188894,
    }),
    <and so on>
]

m29Int and the like must match column names in the input file. They are case-sensitive. Column names are parsed out from the first line of text in the input file that has 3 or more tab-delimited substrings. The remaining such strings are treated as data (numbers).

Magnitudes for peaks of one molecule should add up to around 1 (exactness not required, but if they add up to, say, 10, condition value may be useless)

You can also specify weights for masses (also in MassDecomposerScript.py). You may want to decrease weights of "buggy" masses, such as 28, which includes CO outgassing of cathode, that may be affected by other gases being analyzed). Or you may want to increase some, to force calculation of some molecules from some peaks preferentially.

  1. Apply some preprocessing to the input file. Particularly, subtract background

  2. drag-drop the file to be processed onto MassDecomposer.bat. Input file must be tab-delimited. Comma and point are both treated as decimal point; group separators are not supported.

-> two files should appear in the directory your original file is stored: one with "_proc" and one with "_proc_matrix" added to the name.

  1. analysis:

4.1 Inspect condition value. This value is approximately by how much the errors are being inflated. If >10, the decomposition is very ambiguous.

4.2 Inspect residuals. Substantial magnitudes there mean you have some other signals in the mass-spectrum, and the magnitudes of molecules are inaccurate.

  1. use the result for science!

...

#. PROFIT

About

Process mass-spectrum mass signals into molecule signals

License:MIT License


Languages

Language:Python 99.5%Language:Batchfile 0.5%