コード例 #1
0
ファイル: aca_lts_eval.py プロジェクト: sot/aca_required_temp
def select_stars(ra, dec, roll, cone_stars):
    id_key = (ra, dec, roll)
    updated_cone_stars = cone_stars
    if id_key not in CAT_CACHE:
        CAT_CACHE[id_key], updated_cone_stars = mini_sausage.select_stars(
            ra, dec, roll, cone_stars)
    return CAT_CACHE[id_key], updated_cone_stars
コード例 #2
0
ファイル: aca_lts_eval.py プロジェクト: sot/aca_required_temp
def select_ri_stars(ra, dec, cone_stars):
    id_key = (ra, dec)
    updated_cone_stars = cone_stars
    if id_key not in RI_CAT_CACHE:
        RI_CAT_CACHE[id_key], updated_cone_stars = mini_sausage.select_stars(
            ra, dec, None, cone_stars, roll_indep=True)
    return RI_CAT_CACHE[id_key], updated_cone_stars
コード例 #3
0
def check_obs(obsid):
    try:
        sc = mica.starcheck.get_starcheck_catalog(obsid)
    except:
        return None
    if sc['obs'] is None:
        return None
    if 'cat' not in sc:
        return None
    if len(sc['cat']) == 0:
        return None
    ra = sc['obs']['point_ra']
    if ra is None:
        return None
    dec = sc['obs']['point_dec']
    roll = sc['obs']['point_roll']
    cone_stars = agasc.get_agasc_cone(ra, dec, radius=1.2,
                                      date=sc['obs']['mp_starcat_time'],
                                      agasc_file='/proj/sot/ska/jeanproj/git/agasc/miniagasc.h5')
    acqs = sc['cat'][(sc['cat']['type'] == 'BOT') | (sc['cat']['type'] == 'ACQ')]
    acq_pass = [re.sub('g\d{1}', '', ap) for ap in acqs['pass']]
    acq_manual = np.array([re.search('X', ap) is not None for ap in acq_pass])
    acq_pass = [re.sub('gX', '', ap) for ap in acq_pass]
    acq_pass = [re.sub('aX', '', ap) for ap in acq_pass]
    acq_pass = np.array([re.sub('^$', 'a1', ap) for ap in acq_pass])

    mini_sausage.set_dither(np.max([sc['obs']['dither_y_amp'], sc['obs']['dither_z_amp'], 8.0]))
    mini_sausage.set_manvr_error(sc['manvr'][-1]['slew_err_arcsec'])
    select, all_stars = mini_sausage.select_stars(ra, dec, roll, cone_stars)
    all_stars['starcheck'] = False
    for star in acqs:
        all_stars['starcheck'][all_stars['AGASC_ID'] == star['id']] = True
    sc_t_ccd, sc_n_acq = aca_required_temp.max_temp(time=sc['obs']['mp_starcat_time'],
                                                stars=all_stars[all_stars['starcheck']])
    ms_t_ccd, ms_n_acq = aca_required_temp.max_temp(time=sc['obs']['mp_starcat_time'],
                                                stars=select)
    print obsid, "starcheck {}".format(sc_t_ccd), "manual? ", np.any(acq_manual), "mine {}".format(ms_t_ccd)
    obs = {'obsid': obsid,
           'sc_t_ccd': sc_t_ccd,
           'sc_had_manual': np.any(acq_manual),
           'ms_t_ccd': ms_t_ccd,
           'total': len(acqs),
           'new': 0}

    for star in acqs:
        if star['id'] in select['AGASC_ID']:
            obs['new'] += 1
    for p in [1, 2, 3, 4]:
        sc_acqs_for_p = acqs[acq_pass == 'a{}'.format(p)]
        obs['sc_n_{}'.format(p)] = len(sc_acqs_for_p)
        new_acqs_for_p = select[(select['stage'] == p)]
        obs['new_n_{}'.format(p)] = 0
        for star in sc_acqs_for_p:
            if star['id'] in new_acqs_for_p['AGASC_ID']:
                obs['new_n_{}'.format(p)] += 1
        obs['extra_n_{}'.format(p)] = len(new_acqs_for_p) - len(sc_acqs_for_p)
    return obs