Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into v010updates2
Browse files Browse the repository at this point in the history
  • Loading branch information
jvansanten committed Jan 30, 2025
2 parents 7321b88 + 9ad5cc2 commit 5ba7bb9
Show file tree
Hide file tree
Showing 10 changed files with 746 additions and 907 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
# renovate: datasource=conda depName=conda-forge/python
python-version: "3.13.1"
# renovate: datasource=pypi depName=ruff versioning=pep440
ruff-version: "0.8.4"
ruff-version: "0.9.3"
4 changes: 2 additions & 2 deletions ampel/util/Observatory.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def compute_sun_moon(self, trange, which="sun", dt_min=5):
end = time.time()
self.logger.debug(
f"Computing {which} motion from {times.min().iso} to {times.max().iso}"
f" (res: {dt_min:.2f} min, {len(times)} steps). Took {end-start:.2f} sec"
f" (res: {dt_min:.2f} min, {len(times)} steps). Took {end - start:.2f} sec"
)
return skypos

Expand Down Expand Up @@ -311,6 +311,6 @@ def compute_visibility(
tot_vis_time = len(times_when_visible) * dt_min
end = time.time()
self.logger.info(
f"source is visible for a total of {tot_vis_time / 60.0:.3f} hours. Took {end-start:.2e} sec"
f"source is visible for a total of {tot_vis_time / 60.0:.3f} hours. Took {end - start:.2e} sec"
)
return times_when_visible
2 changes: 1 addition & 1 deletion ampel/ztf/alert/ZTFFPbotForcedPhotometryAlertSupplier.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ def __next__(self) -> AmpelAlertProtocol:
plt.savefig(
os.path.join(
self.plot_dir,
f'fpbase_{headerdict["name"]}.{self.plot_suffix}',
f"fpbase_{headerdict['name']}.{self.plot_suffix}",
)
)
plt.close("fig")
Expand Down
6 changes: 3 additions & 3 deletions ampel/ztf/dev/ZTFAlert.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def to_alert(cls, file_path: str) -> AmpelAlert:
@staticmethod
def _upper_limit_id(el: dict[str, Any]) -> int:
return int(
f'{(2457754.5 - el["jd"]) * 1000000:.0f}'
f'{str(el["pid"])[8:10]}'
f'{round(abs(el["diffmaglim"]) * 1000):.0f}'
f"{(2457754.5 - el['jd']) * 1000000:.0f}"
f"{str(el['pid'])[8:10]}"
f"{round(abs(el['diffmaglim']) * 1000):.0f}"
)

@classmethod
Expand Down
8 changes: 4 additions & 4 deletions ampel/ztf/ingest/ZiMongoMuxer.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ def _process(
and dp["id"] in ids_dps_superseded
):
self.logger.info(
f'Marking datapoint {dp["id"]} '
f'as superseded by {ids_dps_superseded[dp["id"]]}'
f"Marking datapoint {dp['id']} "
f"as superseded by {ids_dps_superseded[dp['id']]}"
)

# point is newly superseded
Expand Down Expand Up @@ -213,8 +213,8 @@ def _process(
for dp in dps_db or []:
if dp["id"] in ids_dps_superseded:
self.logger.info(
f'Marking datapoint {dp["id"]} '
f'as superseded by {ids_dps_superseded[dp["id"]]}'
f"Marking datapoint {dp['id']} "
f"as superseded by {ids_dps_superseded[dp['id']]}"
)

# point is newly superseded
Expand Down
24 changes: 12 additions & 12 deletions ampel/ztf/t0/ZTFAlertStreamController.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ def merge_processes(processes: list[ProcessModel]) -> ProcessModel:
process = copy.deepcopy(processes[0])

assert process.active
assert (
process.processor.unit == "AlertConsumer"
), "Lead process is an AlertConsumer"
assert process.processor.unit == "AlertConsumer", (
"Lead process is an AlertConsumer"
)
assert isinstance(process.processor.config, dict)

def strip(config):
Expand All @@ -74,15 +74,15 @@ def strip(config):
assert process.controller.config == pm.controller.config
assert process.controller.override == pm.controller.override
assert isinstance(pm.processor.config, dict)
assert (
process.processor.unit == pm.processor.unit
), "All processes are AlertConsumers"
assert strip(process.processor.config) == strip(
pm.processor.config
), "AlertConsumer configs are compatible"
assert strip(process.processor.override) == strip(
pm.processor.override
), "AlertConsumer overrides are compatible"
assert process.processor.unit == pm.processor.unit, (
"All processes are AlertConsumers"
)
assert strip(process.processor.config) == strip(pm.processor.config), (
"AlertConsumer configs are compatible"
)
assert strip(process.processor.override) == strip(pm.processor.override), (
"AlertConsumer overrides are compatible"
)
process.processor.config["directives"] += pm.processor.config["directives"]

process.name = Counter(
Expand Down
6 changes: 3 additions & 3 deletions ampel/ztf/t3/skyportal/SkyPortalClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,9 +730,9 @@ def post_candidate(

def get_source_name(self, view: "TransientView") -> str:
assert view.stock, f"{self.__class__} requires stock records"
assert (
"name" in view.stock
), f"{self.__class__} requires stocks with a `name` field. Did you remember to set AlertConsumer.compiler_opts?"
assert "name" in view.stock, (
f"{self.__class__} requires stocks with a `name` field. Did you remember to set AlertConsumer.compiler_opts?"
)
assert view.stock["name"] is not None
return next(
n for n in view.stock["name"] if isinstance(n, str) and n.startswith("ZTF")
Expand Down
Loading

0 comments on commit 5ba7bb9

Please sign in to comment.