Skip to content

Commit

Permalink
Linting.
Browse files Browse the repository at this point in the history
  • Loading branch information
astronomerritt committed May 10, 2024
1 parent dc1ad78 commit 5684e35
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/adler/adler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@

logger = logging.getLogger(__name__)

def runAdler(cli_args):

def runAdler(cli_args):
logger.info("Beginning Adler.")
logger.info("Ingesting all data for object {} from RSP...".format(cli_args.ssObjectId))

planetoid = AdlerPlanetoid.construct_from_RSP(
cli_args.ssObjectId, cli_args.filter_list, cli_args.date_range
)

logger.info("Data successfully ingested.")
logger.info("Calculating phase curves...")

# now let's do some phase curves!

# get the r filter SSObject metadata
Expand Down
3 changes: 2 additions & 1 deletion src/adler/dataclasses/AdlerData.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ def get_phase_parameters_in_filter(self, filter_name, model_name=None):
try:
model_index = self.filter_dependent_values[filter_index].model_list.index(model_name)
except ValueError:
logger.error("ValueError: Model {} does not exist for filter {} in AdlerData.model_lists.".format(
logger.error(
"ValueError: Model {} does not exist for filter {} in AdlerData.model_lists.".format(
model_name, filter_name
)
)
Expand Down
22 changes: 17 additions & 5 deletions src/adler/dataclasses/AdlerPlanetoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,17 @@ def construct_from_SQL(
)

if len(observations_by_filter) == 0:
logger.error("No observations found for this object in the given filter(s). Check SSOID and try again.")
logger.error(
"No observations found for this object in the given filter(s). Check SSOID and try again."
)
raise Exception(
"No observations found for this object in the given filter(s). Check SSOID and try again."
)

if len(filter_list) > len(observations_by_filter):
logger.info("Not all specified filters have observations. Recalculating filter list based on past observations.")
logger.info(
"Not all specified filters have observations. Recalculating filter list based on past observations."
)
filter_list = [obs_object.filter_name for obs_object in observations_by_filter]
logger.info("New filter list is: {}".format(filter_list))

Expand Down Expand Up @@ -140,13 +144,17 @@ def construct_from_RSP(
)

if len(observations_by_filter) == 0:
logger.error("No observations found for this object in the given filter(s). Check SSOID and try again.")
logger.error(
"No observations found for this object in the given filter(s). Check SSOID and try again."
)
raise Exception(
"No observations found for this object in the given filter(s). Check SSOID and try again."
)

if len(filter_list) > len(observations_by_filter):
logger.info("Not all specified filters have observations. Recalculating filter list based on past observations.")
logger.info(
"Not all specified filters have observations. Recalculating filter list based on past observations."
)
filter_list = [obs_object.filter_name for obs_object in observations_by_filter]
logger.info("New filter list is: {}".format(filter_list))

Expand Down Expand Up @@ -216,7 +224,11 @@ def populate_observations(
data_table = get_data_table(observations_sql_query, service=service, sql_filename=sql_filename)

if len(data_table) == 0:
logger.warning("No observations found in {} filter for this object. Skipping this filter.".format(filter_name))
logger.warning(
"No observations found in {} filter for this object. Skipping this filter.".format(
filter_name
)
)
print(
"WARNING: No observations found in {} filter for this object. Skipping this filter.".format(
filter_name
Expand Down
10 changes: 8 additions & 2 deletions src/adler/dataclasses/dataclass_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ def get_from_table(data_table, column_name, data_type, table_name="default"):
elif data_type == np.ndarray:
data_val = np.array(data_table[column_name])
else:
logger.error("TypeError: Type for argument data_type not recognised for column {} in table {}: must be str, float, int or np.ndarray.".format(column_name, table_name))
logger.error(
"TypeError: Type for argument data_type not recognised for column {} in table {}: must be str, float, int or np.ndarray.".format(
column_name, table_name
)
)
raise TypeError(
"Type for argument data_type not recognised for column {} in table {}: must be str, float, int or np.ndarray.".format(
column_name, table_name
Expand Down Expand Up @@ -134,7 +138,9 @@ def check_value_populated(data_val, data_type, column_name, table_name):
str_is_empty = data_type == str and len(data_val) == 0

if array_length_zero or number_is_nan or str_is_empty:
logger.warning("{} unpopulated in {} table for this object. Storing NaN instead.".format(column_name, table_name))
logger.warning(
"{} unpopulated in {} table for this object. Storing NaN instead.".format(column_name, table_name)
)
print(
"WARNING: {} unpopulated in {} table for this object. Storing NaN instead.".format(
column_name, table_name
Expand Down

0 comments on commit 5684e35

Please sign in to comment.