.. _stage20: Stage 20 ============ .. topic:: Summary - Navigate to ``pacman_run_files``, comment out Stage 10, uncomment Stage 20, and execute ``run_pacman.py``. - Continue with s21 if you want to create spectroscopic light curves and fit them - Continue with s30 if you are ONLY interested in the white light curve (for now) This step finally extracts the spectra! A new Stage 20 workdir is created: ``stage20/s20_run_YYYY-MM-DD_HH-MM-SS`` The extracted light curves and spectra are saved in: ``stage20/s20_run_*/extracted_lc`` PACMAN uses `optimal extraction `_ to extract the spectra. This effectively converts these 2D spectra: .. image:: media/s20/sp2d_0.png Into 1D spectra: .. image:: media/s20/sp1d_0.png The way PACMAN determines the rows which should be used in optimal extraction can be seen in the following plot: .. image:: media/s20/utr0-11.png The first panel (left) shows the 2D spectrum. The column limits are determined using the trace. The second panel (middle) shows the median flux in every column. The third panel (right) shows the absolute difference between the median flux in the adjacent columns. We use these two rows where the flux changes the most as reference rows. The pcf file contains a window parameter. If the two determined peaks are at row=155 & row = 162 and window was set to 12, the data between rows 155-12 and 162+12 will be used in the optimal extraction. When running Stage 20 you will see an output similar to the following: .. code-block:: console Starting s20 Using Stage 10 input directory: ... Location of the new Stage 20 run directory: ... in total #visits, #orbits: (3, 12) ***************** Looping over files: 0%| | 0/225 [00:00