Skip to content

Commit

Permalink
diaSourceId observations test
Browse files Browse the repository at this point in the history
  • Loading branch information
jrob93 committed Aug 6, 2024
1 parent a170c60 commit aab88fe
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/adler/adler.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,8 @@ def runAdler(cli_args):
outlier_flag = sci_utils.outlier_diff(res.value, diff_cut=diff_cut)
df_obs.loc[~mask, "outlier"] = outlier_flag

print(df_obs.columns)

# save the df_obs subset with outlier classification
df_save = df_obs[["midPointMjdTai", "outlier"]]
df_save = df_obs[["diaSourceId", "midPointMjdTai", "outlier"]]
print("save classifications: {}".format(save_file))
logger.info("save classifications: {}".format(save_file))
df_save.to_csv(save_file)
Expand Down
2 changes: 1 addition & 1 deletion src/adler/dataclasses/AdlerPlanetoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def populate_observations(
for filter_name in filter_list:
observations_sql_query = f"""
SELECT
ssObject.ssObjectId, mag, magErr, band, midPointMjdTai, ra, dec, phaseAngle,
ssObject.ssObjectId, ssSource.diaSourceId, mag, magErr, band, midPointMjdTai, ra, dec, phaseAngle,
topocentricDist, heliocentricDist, heliocentricX, heliocentricY, heliocentricZ,
topocentricX, topocentricY, topocentricZ,
eclipticLambda, eclipticBeta
Expand Down
5 changes: 5 additions & 0 deletions src/adler/dataclasses/Observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from adler.dataclasses.dataclass_utilities import get_from_table, get_from_dictionary

OBSERVATIONS_KEYS = {
"diaSourceId": np.ndarray,
"mag": np.ndarray,
"magErr": np.ndarray,
"midPointMjdTai": np.ndarray,
Expand Down Expand Up @@ -37,6 +38,9 @@ class Observations:
filter_name : str
Filter of the observations.
diaSourceId: array_like of ints
Unique identifier of the observation
mag: array_like of floats
Magnitude. This is a placeholder and will be replaced by flux.
Expand Down Expand Up @@ -95,6 +99,7 @@ class Observations:

ssObjectId: str = ""
filter_name: str = ""
diaSourceId: np.ndarray = field(default_factory=lambda: np.zeros(0))
mag: np.ndarray = field(default_factory=lambda: np.zeros(0))
magErr: np.ndarray = field(default_factory=lambda: np.zeros(0))
midPointMjdTai: np.ndarray = field(default_factory=lambda: np.zeros(0))
Expand Down
2 changes: 1 addition & 1 deletion tests/adler/dataclasses/test_Observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_construct_observations_from_data_table():

test_query = f"""
SELECT
ssObject.ssObjectId, mag, magErr, band, midPointMjdTai, ra, dec, phaseAngle,
ssObject.ssObjectId, ssSource.diaSourceId, mag, magErr, band, midPointMjdTai, ra, dec, phaseAngle,
topocentricDist, heliocentricDist, heliocentricX, heliocentricY, heliocentricZ,
topocentricX, topocentricY, topocentricZ,
eclipticLambda, eclipticBeta
Expand Down
Binary file added tests/data/testing_database.db copy
Binary file not shown.

0 comments on commit aab88fe

Please sign in to comment.