Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release fixes 3 #43

Merged
merged 8 commits into from
Jun 28, 2019
Merged
2 changes: 2 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// LCO Jenkins automated docker container build
dockerPipeline("docker.lco.global/observation-portal")
2 changes: 1 addition & 1 deletion observation_portal/blocks/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def convert_pond_block_to_observation(block):
config_extra_params['self_guiding'] = True

instrument_extra_params = {}
if 'rot_angle' in pointing and float(pointing['rot_angle']):
if 'rot_angle' in pointing and pointing['rot_angle'] is not None and float(pointing['rot_angle']):
instrument_extra_params['rotator_angle'] = float(pointing['rot_angle'])
if 'defocus' in molecule and float(molecule['defocus']):
instrument_extra_params['defocus'] = float(molecule['defocus'])
Expand Down
15 changes: 11 additions & 4 deletions observation_portal/common/rise_set_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from observation_portal.common.configdb import configdb
from observation_portal.common.downtimedb import DowntimeDB
from observation_portal.requestgroups.target_helpers import TARGET_TYPE_HELPER_MAP

HOURS_PER_DEGREES = 15.0

Expand Down Expand Up @@ -151,11 +152,17 @@ def filter_out_downtime_from_intervalsets(intervalsets_by_telescope: dict) -> di


def get_rise_set_target(target_dict):
if 'type' not in target_dict:
# This is a hack to protect against poorly formatted or empty targets that are submitted directly.
# TODO: Remove this check when target models are updated to handle when there is no target
if (
'type' not in target_dict
or target_dict['type'].upper() not in TARGET_TYPE_HELPER_MAP
or not TARGET_TYPE_HELPER_MAP[target_dict['type'].upper()](target_dict).is_valid()
):
return make_hour_angle_target(
hour_angle=Angle(degrees=0),
dec=Angle(degrees=0),
)
hour_angle=Angle(degrees=0),
dec=Angle(degrees=0),
)
if target_dict['type'] in ['ICRS', 'HOUR_ANGLE']:
pmra = (target_dict['proper_motion_ra'] / 1000.0 / cos(radians(target_dict['dec']))) / 3600.0
pmdec = (target_dict['proper_motion_dec'] / 1000.0) / 3600.0
Expand Down
2 changes: 2 additions & 0 deletions observation_portal/requestgroups/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def get_absolute_url(self):

def as_dict(self):
ret_dict = model_to_dict(self)
ret_dict['created'] = self.created
ret_dict['submitter'] = self.submitter.username
ret_dict['proposal'] = self.proposal.id
ret_dict['requests'] = [r.as_dict() for r in self.requests.all()]
Expand Down Expand Up @@ -190,6 +191,7 @@ def get_id_display(self):

def as_dict(self, for_observation=False):
ret_dict = model_to_dict(self, exclude=self.SERIALIZER_EXCLUDE)
ret_dict['modified'] = self.modified
ret_dict['duration'] = self.duration
ret_dict['configurations'] = [c.as_dict() for c in self.configurations.all()]
if not for_observation:
Expand Down
2 changes: 1 addition & 1 deletion observation_portal/userrequests/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def convert_requestgroup_to_userrequest(requestgroup):
for request in userrequest['requests']:
request['completed'] = None # if request['state'] != 'COMPLETED' else request['modified']
request['target'] = request['configurations'][0]['target']
request['target']['type'] = rg_target_type_to_ur(request['target']['type'])
request['target']['type'] = rg_target_type_to_ur(request['target'].get('type', ''))
request['target']['radvel'] = request['target'].get('extra_params', {}).get('radial_velocity', 0.0)
request['target']['vmag'] = request['target'].get('extra_params', {}).get('v_magnitude', None)
request['constraints'] = request['configurations'][0]['constraints']
Expand Down