Skip to content

Commit

Permalink
Merge branch 'bhtom2-test'
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurii Purdenko committed Dec 2, 2024
2 parents 65aa5a3 + e583d32 commit 91d9816
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 19 deletions.
47 changes: 30 additions & 17 deletions bhtom2/bhtom_common/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,37 @@ def get_observatory(self, obj):


def get_calibration_data(self, obj):

calibration_data = Calibration_data.objects.filter(dataproduct=obj)
return [
{
'id': cal.id,
'time_photometry': cal.modified,
'mjd': cal.mjd,
'calib_survey_filter': f"{cal.use_catalog.survey}/{cal.use_catalog.filters}",
'standardised_to': f"{cal.survey}/{cal.best_filter}" if cal.survey and cal.best_filter else None,
'magnitude': cal.mag,
'zp': cal.zeropoint,
'scatter': cal.scatter,
'number of datapoints used for calibration': cal.npoints,
'outlier fraction': cal.outlier_fraction,
'matching radius[arcsec]': cal.match_distans
cal = Calibration_data.objects.filter(dataproduct=obj).first()
if not cal:
return {
'id': "",
'time_photometry': "",
'mjd': "",
'calib_survey_filter': "",
'standardised_to': "",
'magnitude': "",
'zp': "",
'scatter': "",
'number of datapoints used for calibration': "",
'outlier fraction': "",
'matching radius[arcsec]': ""
}
for cal in calibration_data
]
return {
'id': cal.id or "",
'time_photometry': cal.modified or "",
'mjd': cal.mjd or "",
'calib_survey_filter': f"{cal.use_catalog.survey or ''}/{cal.use_catalog.filters or ''}" if cal.use_catalog else "",
'standardised_to': f"{cal.survey or ''}/{cal.best_filter or ''}" if cal.survey and cal.best_filter else "",
'magnitude': cal.mag or "",
'zp': cal.zeropoint or "",
'scatter': cal.scatter or "",
'number of datapoints used for calibration': cal.npoints or "",
'outlier fraction': cal.outlier_fraction or "",
'matching radius[arcsec]': cal.match_distans or ""
}





Expand Down
4 changes: 2 additions & 2 deletions bhtom2/bhtom_targets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ def import_targets(targets, group_name=None, user=None):
importance = target_fields.get('importance', str(9.99))
cadence = target_fields.get('cadence', str(1.0))
targetType = target_fields.get('type', Target.SIDEREAL)

classification = target_fields.get('classification', '')
target_fields = {
"name": gaia_alerts_name, "ra": ra, "dec": dec, "epoch": 2000.0,
"discovery_date": disc, "importance": importance, "cadence": cadence,
"description": description, "type": targetType
"description": description, "type": targetType, 'classification': classification,
}
logger.info(f"Import: Gaia Alerts harvester used to fill the target info as {gaia_alerts_name}")

Expand Down

0 comments on commit 91d9816

Please sign in to comment.