Skip to content

Commit

Permalink
Merge pull request #43 from LCOGT/release_fixes_3
Browse files Browse the repository at this point in the history
Release fixes 3
  • Loading branch information
eheinrich committed Jun 28, 2019
2 parents 1d8bbef + d8280fe commit a2fe3df
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
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

0 comments on commit a2fe3df

Please sign in to comment.