Skip to content

Commit

Permalink
Split columns for each flavor (#28)
Browse files Browse the repository at this point in the history
* Split columns for each flavor

* PEP8
  • Loading branch information
JulienPeloton authored Aug 10, 2023
1 parent ae4255c commit 4370ce8
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 20 deletions.
2 changes: 0 additions & 2 deletions fink_spins/generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
import argparse
import logging
import io
import sys
import os

import numpy as np
import pandas as pd

import rocks
Expand Down
57 changes: 39 additions & 18 deletions fink_spins/ssoft.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,8 @@
'last_jd': {'type': 'double', 'description': 'Julian Date for the last detection in Fink, in UTC'},
'H_1': {'type': 'double', 'description': 'Absolute magnitude for the ZTF filter band g'},
'H_2': {'type': 'double', 'description': 'Absolute magnitude for the ZTF filter band r'},
'G1_1': {'type': 'double', 'description': 'G1 phase parameter for the ZTF filter band g'},
'G1_2': {'type': 'double', 'description': 'G1 phase parameter for the ZTF filter band r'},
'G2_1': {'type': 'double', 'description': 'G2 phase parameter for the ZTF filter band g'},
'G2_2': {'type': 'double', 'description': 'G2 phase parameter for the ZTF filter band r'},
'R': {'type': 'double', 'description': 'Oblateness of the object'},
'alpha0': {'type': 'double', 'description': 'Right ascension of the spin axis (EQJ2000), in degree'},
'delta0': {'type': 'double', 'description': 'Declination of the spin axis (EQJ2000), in degree'},
'obliquity': {'type': 'double', 'description': 'Obliquity of the spin axis, in degree'},
'err_H_1': {'type': 'double', 'description': 'Uncertainty on the absolute magnitude for the ZTF filter band g'},
'err_H_2': {'type': 'double', 'description': 'Uncertainty on the absolute magnitude for the ZTF filter band r'},
'err_G1_1': {'type': 'double', 'description': 'Uncertainty on the G1 phase parameter for the ZTF filter band g'},
'err_G1_2': {'type': 'double', 'description': 'Uncertainty on the G1 phase parameter for the ZTF filter band r'},
'err_G2_1': {'type': 'double', 'description': 'Uncertainty on the G2 phase parameter for the ZTF filter band g'},
'err_G2_2': {'type': 'double', 'description': 'Uncertainty on the G2 phase parameter for the ZTF filter band r'},
'err_R': {'type': 'double', 'description': 'Uncertainty on the oblateness'},
'err_alpha0': {'type': 'double', 'description': 'Uncertainty on the right ascension of the spin axis (EQJ2000), in degree'},
'err_delta0': {'type': 'double', 'description': 'Uncertainty on the declination of the spin axis (EQJ2000), in degree'},
'max_cos_lambda': {'type': 'double', 'description': 'Maximum of the absolute value of the cosine for the aspect angle'},
'mean_cos_lambda': {'type': 'double', 'description': 'Mean of the absolute value of the cosine for the aspect angle'},
'min_cos_lambda': {'type': 'double', 'description': 'Minimum of the absolute value of the cosine for the aspect angle'},
'min_phase': {'type': 'double', 'description': 'Minimum phase angle of the observations used to compute the phase function, in degree'},
'min_phase_1': {'type': 'double', 'description': 'Minimum phase angle of the observations used to compute the phase function for the ZTF filter band g, in degree'},
'min_phase_2': {'type': 'double', 'description': 'Minimum phase angle of the observations used to compute the phase function for the ZTF filter band r, in degree'},
Expand All @@ -89,6 +71,45 @@
'version': {'type': 'str', 'description': 'Version of the SSOFT YYYY.MM'},
}

COLUMNS_SHG1G2 = {
'G1_1': {'type': 'double', 'description': 'G1 phase parameter for the ZTF filter band g'},
'G1_2': {'type': 'double', 'description': 'G1 phase parameter for the ZTF filter band r'},
'G2_1': {'type': 'double', 'description': 'G2 phase parameter for the ZTF filter band g'},
'G2_2': {'type': 'double', 'description': 'G2 phase parameter for the ZTF filter band r'},
'R': {'type': 'double', 'description': 'Oblateness of the object'},
'alpha0': {'type': 'double', 'description': 'Right ascension of the spin axis (EQJ2000), in degree'},
'delta0': {'type': 'double', 'description': 'Declination of the spin axis (EQJ2000), in degree'},
'obliquity': {'type': 'double', 'description': 'Obliquity of the spin axis, in degree'},
'err_G1_1': {'type': 'double', 'description': 'Uncertainty on the G1 phase parameter for the ZTF filter band g'},
'err_G1_2': {'type': 'double', 'description': 'Uncertainty on the G1 phase parameter for the ZTF filter band r'},
'err_G2_1': {'type': 'double', 'description': 'Uncertainty on the G2 phase parameter for the ZTF filter band g'},
'err_G2_2': {'type': 'double', 'description': 'Uncertainty on the G2 phase parameter for the ZTF filter band r'},
'err_R': {'type': 'double', 'description': 'Uncertainty on the oblateness'},
'err_alpha0': {'type': 'double', 'description': 'Uncertainty on the right ascension of the spin axis (EQJ2000), in degree'},
'err_delta0': {'type': 'double', 'description': 'Uncertainty on the declination of the spin axis (EQJ2000), in degree'},
'max_cos_lambda': {'type': 'double', 'description': 'Maximum of the absolute value of the cosine for the aspect angle'},
'mean_cos_lambda': {'type': 'double', 'description': 'Mean of the absolute value of the cosine for the aspect angle'},
'min_cos_lambda': {'type': 'double', 'description': 'Minimum of the absolute value of the cosine for the aspect angle'},
}

COLUMNS_HG1G2 = {
'G1_1': {'type': 'double', 'description': 'G1 phase parameter for the ZTF filter band g'},
'G1_2': {'type': 'double', 'description': 'G1 phase parameter for the ZTF filter band r'},
'G2_1': {'type': 'double', 'description': 'G2 phase parameter for the ZTF filter band g'},
'G2_2': {'type': 'double', 'description': 'G2 phase parameter for the ZTF filter band r'},
'err_G1_1': {'type': 'double', 'description': 'Uncertainty on the G1 phase parameter for the ZTF filter band g'},
'err_G1_2': {'type': 'double', 'description': 'Uncertainty on the G1 phase parameter for the ZTF filter band r'},
'err_G2_1': {'type': 'double', 'description': 'Uncertainty on the G2 phase parameter for the ZTF filter band g'},
'err_G2_2': {'type': 'double', 'description': 'Uncertainty on the G2 phase parameter for the ZTF filter band r'},
}

COLUMNS_HG = {
'G_1': {'type': 'double', 'description': 'G phase parameter for the ZTF filter band g'},
'G_2': {'type': 'double', 'description': 'G phase parameter for the ZTF filter band r'},
'err_G_1': {'type': 'double', 'description': 'Uncertainty on the G phase parameter for the ZTF filter band g'},
'err_G_2': {'type': 'double', 'description': 'Uncertainty on the G phase parameter for the ZTF filter band r'},
}

@pandas_udf(MapType(StringType(), FloatType()), PandasUDFType.SCALAR)
def estimate_sso_params_spark(ssnamenr, magpsf, sigmapsf, jd, fid, ra, dec, method, model):
""" Extract phase and spin parameters from Fink alert data using Apache Spark
Expand Down

0 comments on commit 4370ce8

Please sign in to comment.