util.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:synthesizAR 作者: wtbarnes 项目源码 文件源码
def convert_angle_to_length(hmi_map, angle_or_length, working_units=u.meter):
    """
    Helper for easily converting between angle and length units. If converting to length, returned 
    units will be `~astropy.units.cm`. If converting to angle, the returned units will be 
    `~astropy.units.arcsec`.
    """
    observed_distance = (hmi_map.dsun - hmi_map.rsun_meters)
    radian_length = [(u.radian, u.meter, lambda x: observed_distance*x, lambda x: x/observed_distance)]
    converted = solarbextrapolation.utilities.decompose_ang_len(angle_or_length,
                                                                working_units=working_units,
                                                                equivalencies=radian_length)

    if working_units == u.meter:
        return converted.to(u.cm)
    else:
        return converted.to(u.arcsec)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号