From ac72cba43986efc5502329abd5a1904e342aa546 Mon Sep 17 00:00:00 2001 From: Robert Stein Date: Thu, 8 Dec 2022 04:45:44 -0800 Subject: [PATCH] Lintify csvlog --- winterdrp/processors/csvlog.py | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/winterdrp/processors/csvlog.py b/winterdrp/processors/csvlog.py index b49efce28..32898bd8c 100644 --- a/winterdrp/processors/csvlog.py +++ b/winterdrp/processors/csvlog.py @@ -1,8 +1,9 @@ +""" +Module to generate a CSV log of observations +""" import logging import os -import astropy.io.fits -import numpy as np import pandas as pd from winterdrp.data import ImageBatch @@ -11,33 +12,46 @@ logger = logging.getLogger(__name__) -default_keys = [base_name_key] + core_fields +default_log_keys = [base_name_key] + core_fields class CSVLog(BaseImageProcessor): + """ + Processor to generate a CSV log + """ base_key = "csvlog" def __init__( self, - export_keys: list[str] = default_keys, + export_keys: list[str] = None, output_sub_dir: str = "", output_base_dir: str = None, - *args, - **kwargs, ): - super().__init__(*args, **kwargs) + super().__init__() + if export_keys is None: + export_keys = default_log_keys self.export_keys = export_keys self.output_sub_dir = output_sub_dir self.output_base_dir = output_base_dir def __str__(self) -> str: - return f"Processor to create a CSV log summarising the image metadata." + return "Processor to create a CSV log summarising the image metadata." - def get_log_name(self): + def get_log_name(self) -> str: + """ + Returns the custom log name + + :return: Lof file name + """ return f"{self.night}_log.csv" - def get_output_path(self): + def get_output_path(self) -> str: + """ + Returns the full log output path + + :return: log path + """ output_base_dir = self.output_base_dir if output_base_dir is None: output_base_dir = self.night_sub_dir