Commit f2afcfb7 authored by Carl Schaffer's avatar Carl Schaffer
Browse files

fixing nodel path and access of predictions

parent 82ff2a75
......@@ -4,7 +4,7 @@ from pathlib import Path
import joblib
import numpy as np
_coord_model_path = Path(__file__).parent.parent / 'gris_coordinate_study' / 'multi_tree_stdx38_stdy36.gz'
_coord_model_path = Path(__file__).parent / 'gris_coordinate_study' / 'multi_tree_stdx38_stdy36.gz'
_coord_model = joblib.load(_coord_model_path)
coord_model_stdx, coord_model_stdy = (int(i) for i in
re.search(r'stdx(\d+)_stdy(\d+)', _coord_model_path.name).groups())
......@@ -20,17 +20,21 @@ def get_coords_ml(gris_fitsfile):
Returns: x,y tuple of the estimated observation center in Helioprojective Coordinates
"""
features = ['SLITPOSX', 'SLITPOSY', 'AZIMUT', 'P0ANGLE']
features = ['SLITPOSX', 'SLITPOSY', 'AZIMUT']
vals = [gris_fitsfile.header[f] for f in features]
vals.append(gris_fitsfile.p0_angle)
# Insert bogus parallax angle, it is 0 for all cases I observed
# so far anyway plus is not used very strongly by the model
vals.insert(2, 0)
date = gris_fitsfile.obs_time
# Insert Zenit
vals.insert(4, gris_fitsfile.zenit)
vals.append(date.day_of_year)
# Insert date parameters
date = gris_fitsfile.obs_time
day_of_year = date.timetuple().tm_yday
vals.append(day_of_year)
vals.append(date.year)
x, y = _coord_model.predict(np.array(vals).reshape(-1, 1).T)
x, y = _coord_model.predict(np.array(vals).reshape(-1, 1).T)[0]
return x, y, coord_model_stdx, coord_model_stdy
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment