예제 #1
0
def run_pyger_cases(cases, savedwell1=False):
    
    for case in cases:

        models = (case['constraint_model'],)
        msids = (case['msid'].lower(),)
        
        if 'dh_heater' in case.keys():
            if 'true' in case['dh_heater'].lower():
                dh_heater = True 
                dh = 'ON'
            else:
                dh_heater = False
                dh = 'OFF'

        coolpitchrange = None
        if 'cool_pitch_min' in case.keys():
            if 'none' not in case['cool_pitch_min'].lower():
                coolpitchrange = (int(case['cool_pitch_min']), int(case['cool_pitch_max']))
            

        constraints1 = pyger.calc_constraints(start=case['start'], 
                                              max_tcylaft6=float(case['max_tcylaft6']),
                                              max_1pdeaat=float(case['max_1pdeaat']),
                                              max_1dpamzt=float(case['max_1dpamzt']),
                                              max_1deamzt=float(case['max_1deamzt']),
                                              max_pftank2t=float(case['max_pftank2t']),
                                              max_aacccdpt=float(case['max_aacccdpt']),
                                              max_4rt700t=float(case['max_4rt700t']),
                                              max_fptemp_11=float(case['max_fptemp_11']),
                                              n_ccd=int(case['n_ccd_dwell1']),
                                              dh_heater=dh_heater,
                                              n_sim=int(case['n_sim']),
                                              max_dwell_ksec=float(case['max_dwell_ksec']),
                                              constraint_models=models)
        if savedwell1:
            nccd = unicode(int(case['n_ccd_dwell1']))
            filename = case['filename'] + '_dwell1.pkl'
            pyger.save_pyger_pickle(constraints1, filename)
            print('Saving to {0}'.format(case['filename'] + '_dwell1.pkl'))

        constraints2, coolstats, hotstats = pyger.calc_constraints2(
                                                    constraints1,
                                                    start=case['start'],
                                                    max_dwell_ksec=float(case['max_dwell_ksec']),
                                                    pitch_num=int(case['dwell_2_pitch_num']),
                                                    hot_dwell_temp_ratio=1.0,
                                                    T_cool_ratio=0.9,
                                                    pitch_range=coolpitchrange,
                                                    constraint_models=models,
                                                    msids=msids,
                                                    n_ccd=int(case['n_ccd_dwell2']),
                                                    dh_heater=dh_heater)
        
        nccd = unicode(int(case['n_ccd_dwell2']))
        filename = case['filename'] + '_dwell2.pkl'
        pickle.dump((constraints2, coolstats, hotstats), open(filename,'w'), protocol=2)
        print('Saving to {0}'.format(filename))
예제 #2
0
파일: plot_by_month.py 프로젝트: sot/pyger
# Set up the font sizes and initialize figure
plt.rc("axes", labelsize=10, titlesize=12)
plt.rc("legend", fontsize=10)
plt.figure(1, figsize=(6,4.5))
plt.clf()

# Step through 2012 in 2-month intervals
for month in range(0, 12, 2):
    start = '2012-%02d-01T00:00:00' % (month+1)
    print '*** Calculating constraints for %s ***' % start
    constraints = pyger.calc_constraints(start=start,
                                         max_tephin=max_tephin,
                                         max_tcylaft6=max_tcylaft6,
                                         max_1pdeaat=max_1pdeaat,
                                         max_1dpamzt=max_1dpamzt,
                                         max_pftank2t=max_pftank2t,
                                         n_ccd=n_ccd,
                                         n_sim=n_sim,
                                         max_dwell_ksec=max_dwell_ksec)
    dwell1_stats = constraints['all'].dwell1_stats
    plt.plot(dwell1_stats['pitch'], dwell1_stats['dur90'] / 1000, label=start[:7])

# Finish making the plot with labels and then save to a file
plt.title('Best-case dwells for 2012 by month')
plt.legend(loc='upper center')
plt.xlabel('Pitch (deg)')
plt.ylabel('Dwell (ksec)')
plt.grid()
plt.ylim(0, max_dwell_ksec * 1.05)
plt.savefig('dwells_2012_month.png')
예제 #3
0
def runtest():
    sim_inputs = pickle.load(open('sim_inputs.pkl'))
    allmodels = sim_inputs.keys()
    constraints = pyger.calc_constraints(start='2013:050', max_dwell_ksec=400,
                                         constraint_models=tuple(allmodels))
    plot_constraints(constraints)