# MIRA online use

This section previously contained first thoughts how MIRA can be integrated in an online data processing scheme for visualizing and writing calibrated data. MIRA now has a procedure `onlineDataProcessing.mira`, which is called by the NCS coordinator (via a Python script) in the following way:

    mira.exe @onlineDataProcessing projId scan obsDate calScan obsDateCal

where `projId` is the Pico Veleta project id (e.g. 203-04), `scan` the scan number to be reduced, `obsDate` the corresponding observing date (format yyymmdd), `calScan` the scan number of the calibration scan, and `obsDateCal` the observing date of the calibration scan (can be different from `obsDate`). MIRA now allows to use two global SIC variables, `ncsData` and `visData`, in order to specify where the raw data are located, and where the plots, XML result files and CLASS spectra should be put. The procedure `onlineDataProcessing.mira` sets these variables to

    ncsData = /ncsServer/mrt/ncs/data
    visData = /vis/203-04

The raw data are searched in `$ncsData/yyyymmdd/scans/` (where yyyymmdd is the observing date), the calibrated CLASS file (spectra.30m) for the project is in `$visData/mira`, the plots are in `$visData/mira/plots`, and the XML result files (for the time being only for pointing and focus) are in `$visData/results`. The conventions for the names of plots and result files are described in the document `http://mrt-lx1/mainWiki/NCSFileStructure`
There is also a new utility procedure, `odp.mira`. It essentially does the same job as the online data processing triggered by the NCS coordinator, but is more interactive. Use:

    @ odp iRef idScan

where `iRef` is the frontend-backend combination to be used for pointings and focus solutions, and `idScan` is the scan to be reduced. The output CLASS file is called spectra.30m, in order to avoid confusion with spectraOdp.30m (produced by the coordinator). The results (XML and CLASS files) are in `$HOME/miraOdp`, the plots in `$HOME/miraOdp/plots`. If the respective directories do not exist, `odp.mira` makes them.
An interactive way to generate a CLASS file from a long list of observations is

    list /reduce [reductionScript] [classFile]

which creates a macro 'reductionScript' (default: reduce.mira) whose execution within your MIRA session (@ reduce) calibrates the data in the current index list (previously specified with `MIRA\FIND`) and writes them to 'classFile' (default: mira.30m).