# Processing DAU/FPA Tuning data

## RG Bias Sweeps

The RG Bias sweep is performed by stepping each RG Mag voltage invididually and collecting multiple raw captures at each voltage level. 

Pre-test Setup:
- Open 2 instances of the DDC Raw Viewer. One set to CCD ID Blue and the other CCD ID Red.

<p class="callout info">It's important that there are only 2 instances open, otherwise they may overwrite each others exported data.</p>

As the sweeps are performed, the raw captures will be automatically exported to `$HOME/ocidata/raw_captures`, where `$HOME` is the user's home directory. The sub-directory names and structures will be generated from the XINA markers. The data for a single RG Mag sweep will be placed into its own directory e.g. `2022-04-13T00-04-58_RgM3_Red`. This directory will contain the raw captures for each voltage step.

The scripts to process the data should be run on this directory. For example:

```
cd ~/ocidata/raw_captures
analyze_biassweep_dau 2022-04-13T16-09-49_RgM3_Red_Dark
```

For light sweeps, you need to provide the analyzed results from the dark sweep.

```
analyze_biassweep_dau 2022-04-13T00-04-58_RgM3_Red 2022-04-13T16-09-49_RgM3_Red_Dark/analysis
```

## RG Low Sweeps

The RG Low sweep is performed by stepping the RG Low voltages and all 3 RG Bias voltages and collecting multiple raw captures at each voltage level.

```
cd ~/ocidata/raw_captures
analyze_RGlow_Sweep_dau <RG Low DIR>
```

## Dark Raw Captures

```
cd ~/ocidata/raw_captures/<DARK DIR>
analyze_dark_dau raw/ 
```

This will produce plots in the `raw/analysis/` directory.

## Light Raw Captures

TBC

```
cd ~/ocidata/raw_captures/
analyze_TDI_dau light_dir dark_dir
```