\section{Raw data checks}
\label{sec:raw_checks}

% -----------------------------------------------------------------------
\subsection{Overview}
\label{sec:raw_checks:overview}
% -----------------------------------------------------------------------

Link to raw checks:

\begin{itemize}
    \item \href{https://docs.google.com/spreadsheets/d/1zvU_XFA1ZOJE111qZKiav7v6ptYveWpDkMHjdhiN06M/edit?gid=1741354113#gid=1741354113}{RAW-NIRPS-HE}
    \item \href{https://docs.google.com/spreadsheets/d/1zvU_XFA1ZOJE111qZKiav7v6ptYveWpDkMHjdhiN06M/edit?gid=1017212188#gid=1017212188}{RAW-NIRPS-HA}
\end{itemize}

Check every day (around 14:00 Montreal time)

If a column title is in yellow do not check today (check yesterday) 

Check for any columns with a FALSE. 

If there is no test for today and yesterday, please run the raw checks again. 

If something is FALSE, please run the raw checks again. 

Any FALSES that someone has told you to ignore should be commented here:
\begin{itemize}
    \item \href{https://docs.google.com/spreadsheets/d/1zvU_XFA1ZOJE111qZKiav7v6ptYveWpDkMHjdhiN06M/edit?gid=68390787#gid=68390787}{Comments-NIRPS-HE}
    \item \href{https://docs.google.com/spreadsheets/d/1zvU_XFA1ZOJE111qZKiav7v6ptYveWpDkMHjdhiN06M/edit?gid=346030560#gid=346030560}{Comments-NIRPS-HA}
\end{itemize}


\important{Please note that checks have dependencies. Do not following instructions for a test if a tests dependencies have failed. The checks should display that a dependency has failed and will not work out if this test has failed until all dependencies have passed.}

% -----------------------------------------------------------------------
\newpage
\subsection{Current tests}
\label{sec:raw_checks:current_tests}
% -----------------------------------------------------------------------

These tests are described in detail in the following sections:

\begin{itemize}
    \item \hyperref[sec:raw_checks:blank]{BLANK}: Always True if night has been run

    \item \hyperref[sec:raw_checks:crit]{CRIT}: Critical checks done at time of download.

    \item \hyperref[sec:raw_checks:system]{SYSTEM}: Checks that the system is functioning properly.
    
    \item \hyperref[sec:raw_checks:has_obsdir]{HAS\_OBSDIR}: Check that an observation directory has files

    \item \hyperref[sec:raw_checks:calib_test]{CALIB\_TEST}: Checks a list of calibrations is present
    
    \item \hyperref[sec:raw_checks:cob_test]{COB\_TEST}: Check if all calibration OB NAMES are present
    
    \item \hyperref[sec:raw_checks:eng_test]{ENG\_TEST}: Check consistency of headers for engineering data
    
    \item \hyperref[sec:raw_checks:calib_qual]{CALIB\_QUAL}: Some basic quality checks for calibration files
    
    \item \hyperref[sec:raw_checks:astrom_test]{ASTROM\_TEST}: Check whether a science object is in the astrometric database

    \item \hyperref[sec:raw_checks:crit_sci]{CRIT\_SCI}: Critical science checks done at time of download.

    \item \hyperref[sec:raw_checks:no_sci]{NO\_SCI}: Check that we have science data for this night 
    
    \item \hyperref[sec:raw_checks:sci_qual]{SCI\_QUAL}: Some basic quality checks for science files. 

\end{itemize}

% -----------------------------------------------------------------------
\newpage
\subsection{RAW CHECK: BLANK}
\label{sec:raw_checks:blank}
% -----------------------------------------------------------------------

\subsubsection{Overview}

This test is there to show that the raw check ran at least once. Even if every other column is FALSE if the check was run for this date it should be True.

\subsubsection{Requirements}

None.

\subsubsection{What to do}

If FALSE there is a problem. 

Please contact the following immediately:

\begin{contacttable}
    \ccNeil{1} & \eeNeil \\
    \ccLison{} & \eeLison \\
    \ccEtienne{} & \eeEtienne \\
    \hline
\end{contacttable}

% -----------------------------------------------------------------------
\newpage
\subsection{RAW CHECK: CRIT}
\label{sec:raw_checks:crit}
% -----------------------------------------------------------------------

\subsubsection{Overview}

This test looks at the critical tests performed by the NIRPS download script.
Currently, the NIRPS download critical tests perform the following tests:

\begin{itemize}
    \item Are there any files on disk?
    \item Are there files missing from the archive? (May update later)
\end{itemize}

\subsubsection{Requirements}

\begin{itemize}
    \item \lstcode{BLANK = True}
\end{itemize}

\subsubsection{What to do}

\important{This test will be FALSE until we have some data for today.}

Please check \hyperref[sec:how_to:observation_times]{the section on when to expect files} to decide whether you should wait or contact someone. Note in good operations you should not have to wait more than 12 hours so if you are checking for `yesterday' you shouldn't wait any longer.

If you have waited long enough please \hyperref[sec:how_to:eso_archives]{check on the ESO archives} to see if there are data for today.

To see what data are on disk, use \texttt{ls /nirps\_raw/nirps/raw-data/nirps\_h*/<YYYY-MM-DD>/*.fits} (replace \texttt{<YYYY-MM-DD>} with the night you want to check). Do see what objects have been observed use \texttt{dfits /nirps\_raw/nirps/raw-data/nirps\_h*/2025-09-06/*.fits | fitsort OBJECT}.

If there is data for today (not including SUN data) then we have a problem. 

Please contact the following immediately:

\begin{contacttable}
    \ccThomas{1} & \eeThomas \\
    \ccNeil{1} & \eeNeil \\
    \ccLison{} & \eeLison \\
    \ccEtienne{} & \eeEtienne \\
    \hline
\end{contacttable}

If there is no data on the ESO archive follow the steps for no data in section \ref{sec:raw_checks:has_obsdir}.

% -----------------------------------------------------------------------
\newpage
\subsection{RAW CHECK: SYSTEM}
\label{sec:raw_checks:system}
% -----------------------------------------------------------------------
\subsubsection{Overview}

This test checks whether certain system features are working. 

Current sub-tests are:
\begin{enumerate}
    \item Test that the email server is working
    \item Test that the disk usage on \lstpath{/cosmos99} is less than 90\%
\end{enumerate}


\subsubsection{Requirements}

\begin{itemize}
    \item \lstcode{BLANK = True}
\end{itemize}

\subsubsection{What to do}

If FALSE please \hyperref[sec:how_to:re_run]{re-run the check} with \lstcode{--test=SYSTEM}. 

If still FALSE please email the following people immediately with the log from the check.

\begin{contacttable}
    \ccNeil{1} & \eeNeil \\
    \ccThomas{} & \eeThomas \\
    \ccLison{} & \eeLison \\
    \ccEtienne{} & \eeEtienne \\
    \hline
\end{contacttable}


% -----------------------------------------------------------------------
\newpage
\subsection{RAW CHECK: HAS\_OBSDIR}
\label{sec:raw_checks:has_obsdir}
% -----------------------------------------------------------------------
\subsubsection{Overview}

This test checks for an observation night directory to exist in the raw directory

\begin{itemize}
    \item For NIRPS-HE: \lstpath{/nirps_raw/nirps/raw-data/nirps_he}
    \item For NIRPS-HA: \lstpath{/nirps_raw/nirps/raw-data/nirps_ha}
\end{itemize}


\subsubsection{Requirements}

\begin{itemize}
    \item \lstcode{BLANK = True}
    \item \lstcode{CRIT = True}
\end{itemize}

\subsubsection{What to do}

If FALSE please \hyperref[sec:how_to:re_run]{re-run the check} with \lstcode{--test=HAS_OBSDIR}. 

If still FALSE then the directory for that day/night has not been created on our machine. 

Please check \hyperref[sec:how_to:observation_times]{here for when you should expect files on our machines}. 

Then you need to \hyperref[sec:how_to:eso_archives]{check the ESO archives for data}.

\note{If there is no data on the ESO archive}

This means that either:
\begin{itemize}
    \item No data was taken
    \item No data was transferred from La Silla to the ESO Archive
\end{itemize}

If there is no data on the ESO archive either no data was taken or no data was transferred from La Silla to the ESO archive. 

Check the observation log if there is a good reason for no data you can \hyperref[sec:how_to:false_check]{report this FALSE} and ignore it – you can always email \hyperref[sec:important_info:need_help]{Lison Malo, Neil Cook, Frederique Baron and Etienne Artigau} to ask if the reason is good enough to ignore there being no data. 

If you are ignoring the data please update the comments section on the APERO checks google sheet. 

If there was no good reason please contact the following people stating there was no data on the ESO archive. 

\begin{contacttable}
    \ccClServiceDesk{1} & \eeClServiceDesk \\
    \ccCurrentObserver{} & \eeCurrentObserver \\
    \ccTelescope{} & \eeTelescope \\
    \ccDNOS{} & \eeDNOS \\
    \ccGaspare{} & \eeGaspare \\
    \ccNeil{} & \eeNeil \\
    \ccLison{} & \eeLison \\
    \ccFred{} & \eeFred \\
    \ccEtienne{} & \eeEtienne \\
    \ccXavierDumusque{} & \eeXavierDumusque \\
    \hline
\end{contacttable}

Note that even if confirmed that there is expected to be no data please still run the manual trigger. In the APERO processing step you will be prompted to continue you can say “No” (this will just skip the processing step) but all the other manual trigger steps should still run.

\note{If there is data on the ESO archive}

This means that we have a problem downloading the data from the ESO archive. 

Please contact the following people stating that there was no data on our machines but was data on the ESO archive.

\begin{contacttable}
    \ccThomas{1} & \eeThomas \\
    \ccLison{} & \eeLison \\
    \ccNeil{} & \eeNeil \\
    \hline
\end{contacttable}


After waiting for one of these people to reply (or resending the email if no one replies) please wait until there is data on our machine. This may be after your time has babysitter is over but you are still responsible for these nights (though in some cases we will run a batch of nights at once). 

Please make sure you let the \lstpath{#nirps_squad} channel know there is no data, and if there is still no data by the time it is the next babysitters turn, let them know that they should not run the manual trigger until you have run your dates. They may or may not be able to check the raw checks in the meantime (depending on whether new data is available).

% -----------------------------------------------------------------------
\newpage
\subsection{RAW CHECK: CALIB\_TEST}
\label{sec:raw_checks:calib_test}
% -----------------------------------------------------------------------

\subsubsection{Overview}

This test checks for at least one of each calibration file (based on the HIERARCH ESO DPR TYPE key)
It will be FALSE if any of the following is missing:
\begin{itemize}
    \item DARK
    \item FLAT,DARK,LAMP
    \item FLAT,LAMP,DARK
    \item WAVE,FP,FP
    \item WAVE,UN1,FP
    \item WAVE,FP,UN1,
    \item WAVE,UN1,UN1
\end{itemize}

\subsubsection{Requirements}

\begin{itemize}
    \item \lstcode{BLANK = True}
    \item \lstcode{CRIT = True}
    \item \lstcode{HAS_OBSDIR = True}
\end{itemize}

\subsubsection{What to do}

If FALSE please \hyperref[sec:how_to:re_run]{re-run the check} with \lstcode{--test=CALIB_TEST}. 

If HAS\_OBSDIR is FALSE please deal with this first and only continue with this section if HAS\_OBSDIR is TRUE. 

Next you need to \hyperref[sec:how_to:eso_archives]{check whether the missing calibrations are on the ESO archive}. 

You will have to check the files found in the ESO archive compared to the data on our machines (in the observation directory that was flagged as FALSE). 

\note{Step 1/3}

\hyperref[sec:how_to:log_in]{ssh into nirps-client}

\note{Step 2/3}

Change to the raw directory:
\begin{itemize}
    \item NIRPS-HE: \lstpath{/nirps_raw/nirps/raw-data/nirps_he/{obsdir}}
    \item NIRPS-HA: \lstpath{/nirps_raw/nirps/raw-data/nirps_ha/{obsdir}}
\end{itemize}

\note{Step 3/3}

Check against the files on the ESO archives. Note that you’ll have to confirm which files are HE and which are HA on the archive as they are not separated.

Note that ticking the “CALIB” box on the ESO archive will only show you calibrations.

\hyperref[sec:how_to:observation_times]{Please check here for when the calibrations should have been taken and on our machines.}

\note{If there is missing data on the ESO archives with a good reason}

This means that either:
\begin{itemize}
    \item The calibration(s) were not taken
    \item The calibration were not transferred from La Silla to the ESO Archive
\end{itemize}

Check the \hyperref[sec:how_to:find_observer]{observation log} if there is a good reason for calibrations not to be taken.

\note{If there is missing data on the ESO Archive with a good reason}

We may need to reject other calibrations before running the manual trigger.

Please contact the following people, stating which calibrations are missing and you need someone to decide if other calibrations need to be rejected. Please also be specific about which calibrations are missing (the error message should say) if all calibrations are missing please mention that the Daily full calibration set usually taken at 12 UT (including darks) are missing (if this is the case).

\begin{contacttable}
    \ccCurrentObserver{1} & \eeCurrentObserver \\
    \ccDNOS{} & \eeDNOS \\
    \ccLison{} & \eeLison \\
    \ccEtienne{} & \eeEtienne \\
    \ccNeil{} & \eeNeil \\
    \ccFred{} & \eeFred \\
    \ccGaspare{} & \eeGaspare \\
    \hline
\end{contacttable}

\note{If there is missing data on the ESO archives with no good reason}

If there was no good reason please contact the following people stating there was no data on the ESO archive.

\begin{contacttable}
    \ccCurrentObserver{1} & \eeCurrentObserver \\
    \ccTelescope{} & \eeTelescope \\
    \ccDNOS{} & \eeDNOS \\
    \ccLison{} & \eeLison \\
    \ccEtienne{} & \eeEtienne \\
    \ccNeil{} & \eeNeil \\
    \ccGaspare{} & \eeGaspare \\
    \ccXavierDumusque{} & \eeXavierDumusque \\
    \hline
\end{contacttable}

Please then wait for a response, re-send the email if you get no response, and act accordingly if there if no data for a good reason.


\note{If there is data on the ESO archive but not on our disks}

This means that we have a problem downloading the data from the ESO archive.

Please contact the following people with the report from the raw check stating there was no data on the ESO archive.

\begin{contacttable}
    \ccThomas{1} & \eeThomas \\
    \ccLison{} & \eeLison \\
    \ccNeil{} & \eeNeil \\
    \ccEtienne{} & \eeEtienne \\
    \hline
\end{contacttable}


After waiting for one of these people to reply (or re-sending the email if no one replies) please wait until there is data on our machine. This may be after your time has babysitter is over but you are still responsible for these nights (though in some cases we will run a batch of nights at once).

Please make sure you let the \lstpath{#nirps_squad} channel know there is no data, and if there is still no data by the time it is the next babysitters turn, let them know that they should not run the manual trigger until you have run your dates. They may or may not be able to check the raw checks in the meantime (depending on whether new data is available).


% -----------------------------------------------------------------------
\newpage
\subsection{RAW CHECK: COB\_TEST}
\label{sec:raw_checks:cob_test}
% -----------------------------------------------------------------------

\subsubsection{Overview}

This test checks whether calibrations exist for both the full daily calibration set and the shorter afternoon calibration set. It uses the \lstcode{HIERARACH ESO OBS NAME} to check for at least one entry of:
\begin{itemize}
    \item Daily-Calibrations-Full-Set
    \item Daily-Calibrations-Full-Set
    \item For Modified Julien dates after 59895
    \item Afternoon-Calibrations
    \item For Modified Julien dates after 60096
\end{itemize}

Note this is called `OB Name' on the ESO archive.


\subsubsection{Requirements}

\begin{itemize}
    \item \lstcode{BLANK = True}
    \item \lstcode{CRIT = True}
    \item \lstcode{HAS_OBSDIR = True}
\end{itemize}

\subsubsection{What to do}

If FALSE please \hyperref[sec:how_to:re_run]{re-run the check} with \lstcode{--test=COB_TEST}. 

If the HAS\_OBSDIR or CALIB\_TEST is FALSE please deal with these first. Only continue with this section if HAS\_OBSDIR and CALIB\_TEST are TRUE.

If the test if still FALSE it may mean the afternoon calibrations have not been taken yet. 

\hyperref[sec:how_to:observation_times]{Please check here for when the afternoon calibrations should have been taken and on our machines}.

\note{If calibrations are abnormally late}

If you have waited 12 hours then please check whether the missing calibrations are on the ESO archive.

The rest of the steps are the same as \hyperref[sec:raw_checks:calib_test]{the CALIB\_TEST section}. 

But make sure when emailing people you point out that you are missing all calibrations from the `Daily-Calibrations-Full-Set' observation block or the `Afternoon-Calibrations' observation block. If the `Daily-Calibrations-Full-Set' of calibrations are missing also mention that this calibation set should have been taking at 12:00UT and includes darks. The `Afternoon-Calibrations' does not include darks, flats etc and only includes FPs and UN1 sequences therefore confusion can arise from just saying `calibrations' are missing - be specific!

To see the `OB Name' column on the archive you have to tick the OB Name box in this section (See figure \ref{fig:eso_archive_ob_name}.

\begin{figure}[!htbp]
    \centering
    \includegraphics[width=\textwidth]{images/eso_archive_ob_name.png}
    \caption{ESO Data Product Info box.}
    \label{fig:eso_archive_ob_name}
\end{figure}

% -----------------------------------------------------------------------
\newpage
\subsection{RAW CHECK: ENG\_TEST}
\label{sec:raw_checks:eng_test}
% -----------------------------------------------------------------------

\subsubsection{Overview}

The engineering test tests the raw calibration files against a suite of sub-tests designed to see if the instrument is behaving as expected. 

\subsubsection{Requirements}

\begin{itemize}
    \item \lstcode{BLANK = TRUE}
    \item \lstcode{CRIT = True}
    \item \lstcode{HAS_OBSDIR = TRUE}
    \item \lstcode{CALIB_TEST = TRUE}
\end{itemize}

\subsubsection{What to do}

If FALSE please \hyperref[sec:how_to:re_run]{re-run the check} with \lstcode{--test=ENG_TEST}. 

If HAS\_OBSDIR is FALSE or CALIB\_TEST is FALSE please deal with these first and only continue with this section if HAS\_OBSDIR is TRUE and TEST is True. 

Please refer to the following sub-section and fix the problems/email the required people as stated. 

Current sub-tests are:

\begin{enumerate}
    \item \enghyperref{test_enclosure_temperature}
    \item \enghyperref{test_enclosure_temperature_setpoint}
    \item \enghyperref{test_vacuum_gauge1}
    \item \enghyperref{test_isolation_valve}
    \item \enghyperref{test_cryo1_stat}
    \item \enghyperref{test_cryo2_stat}
    \item \enghyperref{test_turbo_pump_status}
    \item \enghyperref{test_warning_cryo1}
    \item \enghyperref{test_warning_cryo2}
    \item \enghyperref{test_fp_temperature}
    \item \enghyperref{test_fp_temperature_ext}
    \item \enghyperref{test_fp_temperature_setpoint}
    \item \enghyperref{test_encloser_heater_power}
    \item \enghyperref{ScramblingStatus}
    \item \enghyperref{StretcherStatus}
    \item \enghyperref{BackEnd_DeviceError}

\end{enumerate}

Please make sure to include the failures that are printed out. 

\important{Please copy and paste the text and do not use a screenshot}. 

\subsubsection{Contact information}

A list of all emails for the below sub-sections is here (please do not use all of them unless no one replies and choose the emails for each sub-test. 

\begin{contacttable}
    \ccLison{} & \eeLison \\
    \ccGaspare{} & \eeGaspare \\
    \ccNeil{} & \eeNeil \\
    \ccEtienne{} & \eeEtienne \\
    \ccFred{} & \eeFred \\
    \ccPhilippe{} & \eePhilippe \\
    \ccDNOS{} & \eeDNOS \\
    \ccNirpsSupport{} & \eeNirpsSupport \\
    \hline
\end{contacttable}

% The engineering sub-sub sections
\input{sections/s2z_eng_tests.tex}


% -----------------------------------------------------------------------
\clearpage
\newpage
\subsection{RAW CHECK: CALIB\_QUAL}
\label{sec:raw_checks:calib_qual}
% -----------------------------------------------------------------------

\subsubsection{Overview}

Checks the quality of raw calibration files. The following metrics are used:
\begin{itemize}
    \item Minimum 99th percentile
    \item Maximum 99th percentile
    \item The max fraction of saturated pixels
\end{itemize}

For the following HIERARCH ESO DPR TYPE files:
\begin{itemize}
    \item FLAT:
    \begin{itemize}
        \item FLAT,LAMP,DARK
        \item FLAT,DARK,LAMP
        \item FLAT,LAMP,DARK
        \item ORDERDEF,DARK,LAMP
        \item ORDERDEF,LAMP,DARK
    \end{itemize}
    \item FP:
    \begin{itemize}
        \item WAVE,FP,FP
        \item WAVE,UN1,UN1
        \item WAVE,FP,UN1
        \item WAVE,UN1,FP
        \item CONTAM,DARK,FP
    \end{itemize}
    \item TELLURIC:
    \begin{itemize}
        \item TELLURIC,SKY
    \end{itemize}
\end{itemize}


\subsubsection{Requirements}

\begin{itemize}
    \item \lstcode{BLANK = True}
    \item \lstcode{CRIT = True}
    \item \lstcode{HAS_OBSDIR = True}
    \item \lstcode{CALIB_TEST = True}
\end{itemize}

\subsubsection{What to do}

If FALSE please \hyperref[sec:how_to:re_run]{re-run the check} with \lstcode{--test=CALIB_QUAL}. 

If HAS\_OBSDIR is FALSE or CALIB\_TEST is FALSE please deal with these first and only continue with this section if HAS\_OBSDIR is TRUE and CALIB\_TEST is True.

If still FALSE after re-running the checks please contact the following people with the report from the raw check.

\begin{contacttable}
    \ccEtienne{} & \eeEtienne \\{1}
    \ccNeil{} & \eeNeil \\
    \ccCharles{} & \eeCharles \\
    \ccLison{} & \eeLison \\
    \ccNirpsSupport{} & \eeNirpsSupport \\
    \hline
\end{contacttable}

% -----------------------------------------------------------------------
\newpage
\subsection{RAW CHECK: ASTROM\_TEST}
\label{sec:raw_checks:astrom_test}
% -----------------------------------------------------------------------

\subsubsection{Overview}

This test checks that all science file object names are in the astrometric database. This test, regardless of the observation directory, works on all files. Therefore if one science file is missing from the astrometric database all tests will be FALSE until this is fixed.

\subsubsection{Requirements}

\begin{itemize}
    \item \lstcode{BLANK = True}
    \item \lstcode{CRIT = True}
    \item \lstcode{HAS_OBSDIR = True}
\end{itemize}

\subsubsection{What to do}

If FALSE please \hyperref[sec:how_to:re_run]{re-run the check} with \lstcode{--test=ASTROM_TEST}. 

If still FALSE you’ll get a list of objects to add to the astrometric database (see figure \ref{fig:astrom_chec_display}.

\begin{figure}[!htbp]
    \centering
    \includegraphics[width=\textwidth]{images/astrom_chec_display.png}
    \caption{The log message displayed when the astrometric test is FALSE.}
    \label{fig:astrom_chec_display}
\end{figure}

You must then decide whether these objects should be:
\begin{enumerate}
    \item Added to the astrometric database (for real astrophysical objects not in the solar system)
    \item Added to the astrometric database as a Solar system objects
    \item Added to the rejection database (for anything else)
\end{enumerate}

These three options are described in the next sub-sections.

\note{Adding an object to the astrometric database}

\hyperref[sec:how_to:apero_astrometrics]{Follow the steps here}.

Once you have added the object please email the following people for reference. Please state that no reply is required.

\begin{contacttable}
    \ccNeil{1} & \eeNeil \\
    \ccLison{} & \eeLison \\
    \ccEtienne{} & \eeEtienne \\
    \hline
\end{contacttable}


\note{Solar system objects}

Currently these need to be added manually to the astrometric database.
Please find one of the raw observations and get the object name of the object from the header checking the following keys:
\begin{itemize}
    \item OBJECT
    \item HIERARCH ESO TARG NAME
\end{itemize}

Please then email the following people, stating that you need a solar system object adding to the astrometric database and giving the object name/names from the header.

\begin{contacttable}
    \ccNeil{1} & \eeNeil \\
    \ccLison{} & \eeLison \\
    \ccEtienne{} & \eeEtienne \\
    \hline
\end{contacttable}


\note{Adding an object to the reject list}

\hyperref[sec:how_to:apero_reject]{Follow the steps here}.

Once you have rejected the object please email the following people for reference. Please state that no reply is required.

\begin{contacttable}
    \ccNeil{1} & \eeNeil \\
    \ccLison{} & \eeLison \\
    \ccEtienne{} & \eeEtienne \\
    \hline
\end{contacttable}

\note{What if I've already run the manual trigger?}

In this case it is safest to remove all entries from apero before re-running the trigger (but after adding the object to the astrometric catalogue or the reject list).

To remove an object \hyperref[sec:how_to:apero_remove]{follow the steps here}.


% -----------------------------------------------------------------------
\newpage
\subsection{RAW CHECK: CRIT\_SCI}
\label{sec:raw_checks:crit_sci}
% -----------------------------------------------------------------------

\subsubsection{Overview}

This test looks at the critical tests performed by the NIRPS download script specifically related to the science data.
Currently, the NIRPS download critical tests perform the following tests:

\begin{itemize}
    \item Did we receive an observing log on the APERO gmail? (logs are only generated for GTO data).
    \item Is any data from the observing logs missing on the ESO archive?
\end{itemize}

\important{If you choose to override this test in most cases you will need to override \lstcode{NO_SCI} as well.}

\subsubsection{Requirements}

\begin{itemize}
    \item \lstcode{BLANK = True}
    \item \lstcode{CRIT = True}
    \item \lstcode{HAS_OBSDIR = True}
\end{itemize}

\subsubsection{What to do}

If FALSE please \hyperref[sec:how_to:re_run]{re-run the check} with \lstcode{--test=CRIT_SCI}. If still FALSE, this should tell you that `Check logs failed - Check for files from the observing logs missing on the archive'. 

This either means that:
\begin{enumerate}
    \item we did not receive a log
    \item there is data from the logs missing on the archive. 
\end{enumerate}

Most of the time it is option 1 (we did not receive a log). To confirm this, use \lstcode{ls /nirps_raw/nirps/lasilla-night-logs/ -ltr}.

\note{If we did not receive a log}

Check the \hyperref[sec:how_to:find_observer]{observation log} to see if any data was taken. If no GTO science observations were taken, it is expected that we did not receive the log. You can also double check that there is no science data on the ESO archive.

\important{Note that the logs are only generated for GTO data}, so this test will be FALSE if there was no science data. Make sure \href{https://archive.eso.org/wdb/forms/cas/eso_archive_main.html}{you look at the special access ESO archive}. Also make sure you turn on the PI CoI tick box in the pink box. For GTO data this list should be something similar to the following: \lstcode{BOUCHY, DOYON, MIGNON, MALO, ALLART, ARTIGAU...}.

You can also check \hyperref[sec:how_to:find_science]{the how to find science data section}. If there was science data, please reach out (see below).

If you need to see what data are on disk, use \lstcode{ls /nirps\_raw/nirps/raw-data/nirps\_h*/<YYYY-MM-DD>/*.fits} (replace \lstcode{<YYYY-MM-DD>} with the night you want to check). Do see what objects have been observed use \lstcode{dfits /nirps\_raw/nirps/raw-data/nirps\_h*/2025-09-06/*.fits | fitsort OBJECT}.

\note{If we received a log and the archive is missing data from the log}

This should never happen. It means that some data was taken at the telescope but never made it to the archive and we should understand why. Please contact us (see below).

\note{If there is a good reason for no log}

\hyperref[sec:how_to:override_check]{Run the apero check override code} with \lstcode{--test=CRIT_SCI}.

\note{If there is no good reason for no logs, or missing files on the archive}

If as far as you can tell there should be a log and there is none, or if some data is missing from the archive, please check the \hyperref[sec:how_to:eso_archives]{ESO archive to see what data is available}. 

You can filter to only show `SCIENCE' data using the category `SCIENCE' in the yellow section (see figure \ref{fig:eso_archive_ob_name}).

Please contact the following people stating that we did not receive a log from the telescope, or that there is data from the logs missing on the archive.

\begin{contacttable}
    \ccThomas{1} & \eeThomas \\
    \ccLison{} & \eeLison \\
    \ccNeil{} & \eeNeil \\
    \ccCurrentObserver{1} & \eeCurrentObserver \\
    \ccTelescope{} & \eeTelescope \\
    \ccDNOS{} & \eeDNOS \\
    \ccNeil{} & \eeNeil \\
    \ccLison{} & \eeLison \\
    \ccEtienne{} & \eeEtienne \\
    \ccLucile{} & \eeLucile \\
    \ccRomain{} & \eeRomain \\
    \hline
\end{contacttable}


% -----------------------------------------------------------------------
\newpage
\subsection{RAW CHECK: NO\_SCI}
\label{sec:raw_checks:no_sci}
% -----------------------------------------------------------------------

\subsubsection{Overview}

Check whether there are any science observations for a night.

\important{In most cases this test will need overriding if you did an override for \lstcode{CRIT_SCI}.}

For the following HIERARCH ESO DPR TYPE files:
\begin{itemize}
    \item SCIENCE: 
    \begin{itemize}
        \item OBJECT,SKY
        \item OBJECT,FP
    \end{itemize}
\end{itemize}


\subsubsection{Requirements}

\begin{itemize}
    \item \lstcode{BLANK = True}
    \item \lstcode{CRIT = True}
    \item \lstcode{HAS_OBSDIR = True}
    \item \lstcode{CRIT_SCI = True}
    \item Check yesterday's data not today's
\end{itemize}

\subsubsection{What to do}

If FALSE please \hyperref[sec:how_to:re_run]{re-run the check} with \lstcode{--test=NO_SCI}. 

IF still FALSE please check \hyperref[sec:how_to:find_science]{the how to find science data section}.

\note{If there is a good reason for no science data}

\hyperref[sec:how_to:override_check]{Run the apero check override code} with \lstcode{--test=NO_SCI}.

\note{If there is no good reason for no science data}

If as far as you can tell there should be science data please check the \hyperref[sec:how_to:eso_archives]{ESO archive to see if data is available}. 

You can filter to only show `SCIENCE' data using the category `SCIENCE' in the yellow section (see figure \ref{fig:eso_archive_ob_name}).

\note{If there is science data on the ESO archive}

Please contact the following people stating that there was no data on our machines but was data on the ESO archive.

\begin{contacttable}
    \ccThomas{1} & \eeThomas \\
    \ccLison{} & \eeLison \\
    \ccNeil{} & \eeNeil \\
    \hline
\end{contacttable}


\note{If there is no science data on the ESO archive}

Please contact the following people asking whether science data was observed for the observation night:

\begin{contacttable}
    \ccCurrentObserver{1} & \eeCurrentObserver \\
    \ccTelescope{} & \eeTelescope \\
    \ccDNOS{} & \eeDNOS \\
    \ccNeil{} & \eeNeil \\
    \ccLison{} & \eeLison \\
    \ccFred{} & \eeFred \\
    \ccEtienne{} & \eeEtienne \\
    \ccLucile{} & \eeLucile \\
    \ccRomain{} & \eeRomain \\
    \hline
\end{contacttable}


% -----------------------------------------------------------------------
\newpage
\subsection{RAW CHECK: SCI\_QUAL}
\label{sec:raw_checks:sci_qual}
% -----------------------------------------------------------------------

\subsubsection{Overview}

Checks the quality of raw science files. The following metrics are used:

\begin{itemize}
    \item Minimum 99th percentile
    \item Maximum 99th percentile
    \item The max fraction of saturated pixels
\end{itemize}

For the following HIERARCH ESO DPR TYPE files:

\begin{itemize}
    \item SCIENCE: 
    \begin{itemize}
        \item OBJECT,SKY
        \item OBJECT,FP
    \end{itemize}
\end{itemize}

\subsubsection{Requirements}

\begin{itemize}
    \item \lstcode{BLANK = True}
    \item \lstcode{CRIT = True}
    \item \lstcode{HAS_OBSDIR = True}
    \item \lstcode{CRIT_SCI = True}
    \item \lstcode{NO_SCI = True}
    \item Check yesterday's data not today's
\end{itemize}

\subsubsection{What to do}

If FALSE please \hyperref[sec:how_to:re_run]{re-run the check} with \lstcode{--test=SCI_QUAL}. 

If HAS\_OBSDIR is FALSE or NO\_SCI is FALSE please deal with these first and only continue with this section if HAS\_OBSDIR is TRUE and NO\_SCI is True.

Note science files will appear after a night has been completed. The way the observation directories are set up means you have to wait until the next calendar day to do this test. 

If still FALSE after re-running the checks please contact the following people with the report from the raw check.

\begin{contacttable}
    \ccEtienne{1} & \eeEtienne \\
    \ccNeil{} & \eeNeil \\
    \ccCharles{} & \eeCharles \\
    \ccLison{} & \eeLison \\
    \hline
\end{contacttable}



% % -----------------------------------------------------------------------
% \newpage
% \subsection{RAW CHECK: NO\_SCI}
% \label{sec:raw_checks:no_sci}
% % -----------------------------------------------------------------------

% \subsubsection{Overview}

% \subsubsection{Requirements}

% \begin{itemize}
%     \item \lstcode{BLANK = True}
% \end{itemize}

% \subsubsection{What to do}