本文整理汇总了Python中nell.utilities.TimeAgent.deg2rad方法的典型用法代码示例。如果您正苦于以下问题:Python TimeAgent.deg2rad方法的具体用法?Python TimeAgent.deg2rad怎么用?Python TimeAgent.deg2rad使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nell.utilities.TimeAgent
的用法示例。
在下文中一共展示了TimeAgent.deg2rad方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_solar_avoid_obs_param
# 需要导入模块: from nell.utilities import TimeAgent [as 别名]
# 或者: from nell.utilities.TimeAgent import deg2rad [as 别名]
def update_solar_avoid_obs_param(self, fdata, old_value):
"""
For taking a json dict and converting its given
solar avoid float field into a 'Solar Avoid' float
observing parameter.
"""
new_value = self.get_field(fdata, "solar_avoid", None, float)
if new_value is not None: # make sure it's in a legal range
try:
fv = float(new_value)
if fv < 0.0 or fv > 360.0: # should this be 90?
return # value out of range
new_value = TimeAgent.deg2rad(new_value) # DB in radians
except:
return # nonsense value
parameter = Parameter.objects.filter(name="Solar Avoid")[0]
self.update_parameter(old_value, new_value, parameter)
示例2: update_from_post
# 需要导入模块: from nell.utilities import TimeAgent [as 别名]
# 或者: from nell.utilities.TimeAgent import deg2rad [as 别名]
def update_from_post(self, fdata):
self.set_base_fields(fdata)
self.sesshun.save()
self.sesshun.allotment.psc_time = fdata.get("PSC_time", 0.0)
self.sesshun.allotment.total_time = fdata.get("total_time", 0.0)
self.sesshun.allotment.max_semester_time = fdata.get("sem_time", 0.0)
self.sesshun.allotment.grade = fdata.get("grade", 4.0)
self.sesshun.allotment.save()
self.sesshun.save()
self.sesshun.status.enabled = self.get_field(fdata, "enabled", True, bool)
self.sesshun.status.authorized = self.get_field(fdata, "authorized", True, bool)
self.sesshun.status.complete = self.get_field(fdata, "complete", True, bool)
self.sesshun.status.backup = self.get_field(fdata, "backup", True, bool)
self.sesshun.status.save()
self.sesshun.save()
self.update_bool_obs_param(fdata, "gas"
, "Good Atmospheric Stability"
, self.sesshun.good_atmospheric_stability())
self.update_bool_obs_param(fdata, "transit", "Transit", self.sesshun.transit())
self.update_bool_obs_param(fdata, "keyhole", "Keyhole", self.sesshun.keyhole())
self.update_guaranteed(fdata)
self.update_time_of_day(fdata, self.sesshun.time_of_day())
self.update_irradiance_threshold(fdata, self.sesshun.irradiance())
self.update_lst_parameters('lst_ex', fdata.get('lst_ex'))
self.update_lst_parameters('lst_in', fdata.get('lst_in'))
self.update_xi_obs_param(fdata, self.sesshun.get_min_eff_tsys_factor())
self.update_el_limit_obs_param(fdata
, self.sesshun.get_elevation_limit())
self.update_solar_avoid_obs_param(fdata
, self.sesshun.get_solar_avoidance())
self.update_source_size_obs_param(fdata
, self.sesshun.get_source_size())
# here if the param is not being used, we don't want the default
# values used, but rather None for the 'old_value'
self.update_tr_err_threshold_obs_param(fdata
, self.sesshun.get_tracking_error_threshold_param())
proposition = fdata.get("receiver", None)
if proposition is not None:
self.sesshun.receiver_group_set.all().delete()
self.save_receivers(proposition)
systemName = fdata.get("coord_mode", "J2000")
system = System.objects.get(name = systemName)
h_axis = fdata.get("source_h", None)
v_axis = fdata.get("source_v", None)
try:
t = self.sesshun.target
t.system = system
t.source = fdata.get("source", None)
if h_axis is not None:
t.horizontal = TimeAgent.deg2rad(float(h_axis)) \
if systemName == 'Galactic' \
else TimeAgent.hr2rad(float(h_axis))
t.vertical = TimeAgent.deg2rad(float(v_axis)) if v_axis is not None else t.vertical
t.save()
except Target.DoesNotExist:
self.create_target(fdata)
self.sesshun.save()