Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rcboufleur committed Jan 16, 2025
1 parent 21b08c4 commit 1346e2a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion python/lsst/consdb/efd_transform/queue_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def create_tasks(
if start_time > end_time:
end_time = start_time + proccess_interval_seconds

## start and end times computed before generating the interval list
# start and end times computed before generating the interval list
# self.log.debug(f"Current time: {now}")
# self.log.debug(f"Start time: {start_time}")
# self.log.debug(f"End time: {end_time}")
Expand Down
27 changes: 18 additions & 9 deletions python/lsst/consdb/efd_transform/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

class Summary:
"""
Class to summarize and analyze numeric time-series data with a DatetimeIndex.
Class to summarize and analyze numeric time-series data with a
DatetimeIndex.
Attributes:
data_array (np.ndarray): The numeric values of the DataFrame.
Expand All @@ -27,14 +28,20 @@ def __init__(
Initializes the Summary class with a pandas DataFrame.
Args:
dataframe (pd.DataFrame): A DataFrame with a DatetimeIndex and numeric or boolean data.
exposure_start (Time): Start of the exposure period as an astropy.time.Time object.
exposure_end (Time): End of the exposure period as an astropy.time.Time object.
datatype (Optional[str]): Desired NumPy dtype for the data conversion.
dataframe (pd.DataFrame): A DataFrame with a DatetimeIndex
and numeric or boolean data.
exposure_start (Time): Start of the exposure period as an
astropy.time.Time object.
exposure_end (Time): End of the exposure period as an
astropy.time.Time object.
datatype (Optional[str]): Desired NumPy dtype for the data
conversion.
Raises:
ValueError: If the DataFrame index is not a DatetimeIndex or contains invalid data types.
ValueError: If exposure times are invalid or not compatible with the DataFrame index.
ValueError: If the DataFrame index is not a DatetimeIndex or
contains invalid data types.
ValueError: If exposure times are invalid or not compatible
with the DataFrame index.
"""
if not isinstance(dataframe.index, pd.DatetimeIndex):
raise ValueError("The DataFrame index must be a DatetimeIndex.")
Expand Down Expand Up @@ -107,7 +114,8 @@ def most_recent_value_in_last_minute(self) -> Optional[Union[float, int, bool]]:
Find the most recent value within the last minute of the exposure_end.
Returns:
Optional[Union[float, int, bool]]: The most recent value in the last minute or None if not found.
Optional[Union[float, int, bool]]: The most recent value in the
last minute or None if not found.
"""
try:
# Convert exposure_end (astropy Time) to pandas Timestamp
Expand All @@ -130,7 +138,8 @@ def apply(self, method_name: str, **kwargs) -> Optional[float]:
**kwargs: Additional keyword arguments.
Returns:
Result of the transformation method or None if the method is not callable.
Result of the transformation method or None if the method is not
callable.
"""
if self.data_array.size == 0 or np.all(np.isnan(self._get_numeric_values())):
return None
Expand Down

0 comments on commit 1346e2a

Please sign in to comment.