Skip to content

Commit

Permalink
Merge pull request #514 from alercebroker/features_morecleaning
Browse files Browse the repository at this point in the history
Feature enhancements
  • Loading branch information
ale-munozarancibia authored Dec 11, 2024
2 parents bf31a8b + 576445c commit dca612a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def fleet_model_jax(t, a, w, m_0, t0):


class FleetExtractor(FeatureExtractor):
version = "1.0.1"
version = "1.0.2"
unit = "diff_flux"

def __init__(self, bands: List[str]):
Expand Down Expand Up @@ -180,6 +180,7 @@ def compute_features_single_object(self, astro_object: AstroObject):
sigma=y_err,
p0=[0.6, -0.05, np.mean(y), 0],
bounds=([0.0, -100.0, 0, -50], [10, 0, 30, 10000]),
max_nfev=800, # twice default value
)

model_prediction = fleet_model(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def ulens_model_jax(t, u0, tE, fs, t0, mag_0):


class MicroLensExtractor(FeatureExtractor):
version = "1.0.1"
version = "1.0.2"
unit = "magnitude"

def __init__(self, bands: List[str]):
Expand Down Expand Up @@ -88,6 +88,7 @@ def compute_features_single_object(self, astro_object: AstroObject):
[0, 0, 0, -np.inf, -np.inf],
[np.inf, np.inf, 1, np.inf, np.inf],
),
max_nfev=1000, # twice default value
)

model_prediction = ulens_model(band_observations["mjd"], *parameters)
Expand Down
9 changes: 6 additions & 3 deletions training/lc_classifier_ztf/feature_computation/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ def create_astro_object(lc_df: pd.DataFrame, object_info: pd.Series) -> AstroObj
inplace=True)

lc_df["fid"] = lc_df["fid"].map({1: "g", 2: "r", 3: "i"})
lc_df = lc_df[lc_df["fid"].isin(["g", "r"])]
lc_df["procstatus"] = lc_df["procstatus"].astype(str)

lc_df = lc_df[lc_df["fid"].isin(["g", "r"]) \
& (lc_df["procstatus"] == "0")]

if len(lc_df[lc_df["detected"]]) == 0:
raise NoDetections()
Expand Down Expand Up @@ -99,13 +102,13 @@ def create_astro_object(lc_df: pd.DataFrame, object_info: pd.Series) -> AstroObj
if __name__ == "__main__":
# Build AstroObjects

data_dir = "data_241015"
data_dir = "data_241209"
data_out = data_dir + "_ao"
lightcurve_filenames = os.listdir(data_dir)
lightcurve_filenames = [f for f in lightcurve_filenames if "lightcurves_batch" in f]

object_df = pd.read_parquet(
os.path.join(data_dir, "objects_with_wise_20241016.parquet")
os.path.join(data_dir, "objects_with_wise_20241209.parquet")
)
object_df.set_index("oid", inplace=True)

Expand Down

0 comments on commit dca612a

Please sign in to comment.