Skip to content

Commit

Permalink
modified: src/forcedphot/odc.py
Browse files Browse the repository at this point in the history
  • Loading branch information
szilac committed Oct 1, 2024
1 parent 63c12c6 commit 8f6ddc8
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/forcedphot/odc.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,18 +287,24 @@ def api_connection(self, input_data: dict[str, Any]) -> dict[str, Any]:
ephemeris_data = input_data["ephemeris"]

if "ecsv_file" in ephemeris_data:
results["ephemeris"] = self.ephemeris_client.load_ephemeris_from_ecsv(ephemeris_data["ecsv_file"])
results["ephemeris"] = self.ephemeris_client.load_ephemeris_from_ecsv(
ephemeris_data["ecsv_file"]
)

elif "ecsv_files" in ephemeris_data:
results["ephemeris"] = self.ephemeris_client.load_ephemeris_from_multi_ecsv(ephemeris_data["ecsv_files"])
results["ephemeris"] = self.ephemeris_client.load_ephemeris_from_multi_ecsv(
ephemeris_data["ecsv_files"]
)

elif "service" in ephemeris_data:
if "csv_file" in ephemeris_data:
results["ephemeris"] = self.ephemeris_client.query_from_csv(
service=ephemeris_data["service"],
csv_file=ephemeris_data["csv_file"],
observer_location=ephemeris_data.get("observer_location", EphemerisClient.DEFAULT_OBSERVER_LOCATION),
save_data=ephemeris_data.get("save_data", EphemerisClient.DEFAUT_SAVE_DATA)
observer_location=ephemeris_data.get(
"observer_location", EphemerisClient.DEFAULT_OBSERVER_LOCATION
),
save_data=ephemeris_data.get("save_data", EphemerisClient.DEFAUT_SAVE_DATA),
)
else:
results["ephemeris"] = self.ephemeris_client.query_single(
Expand All @@ -308,8 +314,10 @@ def api_connection(self, input_data: dict[str, Any]) -> dict[str, Any]:
start=ephemeris_data["start"],
end=ephemeris_data["end"],
step=ephemeris_data["step"],
observer_location=ephemeris_data.get("observer_location", EphemerisClient.DEFAULT_OBSERVER_LOCATION),
save_data=ephemeris_data.get("save_data", EphemerisClient.DEFAUT_SAVE_DATA)
observer_location=ephemeris_data.get(
"observer_location", EphemerisClient.DEFAULT_OBSERVER_LOCATION
),
save_data=ephemeris_data.get("save_data", EphemerisClient.DEFAUT_SAVE_DATA),
)
else:
raise ValueError("Invalid ephemeris query parameters")
Expand Down

0 comments on commit 8f6ddc8

Please sign in to comment.