if save:
        bu.make_all_pardirs(agg_path)


    if reprocess:

        datafiles, lengths = bu.find_all_fnames(ddir, ext=config.extensions['data'], \
                                                substr=substr, sort_by_index=True, \
                                                sort_time=False)
        datafiles = datafiles[:Nfiles]

        agg_dat = gu.AggregateData(datafiles, p0_bead=p0_bead, harms=harms, \
                                   plot_harm_extraction=plot_harms, new_trap=new_trap, \
                                   step_cal_drive_freq=71.0, ncore=ncore, noisebins=10, \
                                   aux_data=aux_data, suppress_off_diag=suppress_off_diag, \
                                   fake_attractor_data=fake_attractor_data, \
                                   fake_attractor_data_amp=fake_attractor_data_amp, \
                                   fake_attractor_data_dc=fake_attractor_data_dc, \
                                   fake_attractor_data_freq=fake_attractor_data_freq, \
                                   fake_attractor_data_axis=fake_attractor_data_axis)

        agg_dat.load_grav_funcs(theory_data_dir)

        if save:
            agg_dat.save(agg_path)

        agg_dat.bin_rough_stage_positions()
        #agg_dat.average_resp_by_coordinate()

        # agg_dat.plot_force_plane(resp=0, fig_ind=1, show=True)
        # agg_dat.plot_force_plane(resp=1, fig_ind=2, show=False)
    





for ddir in data_dirs:

    paths = gu.build_paths(ddir, opt_ext=opt_ext)

    datafiles = bu.find_all_fnames(ddir)
    p0_bead = p0_bead_dict[paths['date']]

    if load_files:
        agg_dat = gu.AggregateData(datafiles, p0_bead=p0_bead, harms=harms, \
                                   elec_drive=False, elec_ind=0, plot_harm_extraction=False, \
                                   tfdate=tfdate)       

        agg_dat.save(paths['agg_path'])

    else:
        agg_dat = gu.AggregateData([], p0_bead=p0_bead, harms=harms)
        agg_dat.load(paths['agg_path'])
        agg_dat.p0_bead = p0_bead

    agg_dat.bin_rough_stage_positions(ax_disc=1.0)
    #agg_dat.plot_force_plane(resp=0, fig_ind=1, show=False)
    #agg_dat.plot_force_plane(resp=1, fig_ind=2, show=False)
    #agg_dat.plot_force_plane(resp=2, fig_ind=3, show=False)

    #force_plane_dict = agg_dat.get_vector_force_plane(resp=(0,2), fig_ind=1, \
Esempio n. 3
0
opt_ext = '_harms'
for harm in harms:
    opt_ext += '-' + str(int(harm))
opt_ext += '_first-{:d}'.format(Nfiles)
if len(substr):
    opt_ext += '_{:s}'.format(substr)

for ddir in data_dirs:

    paths = gu.build_paths(ddir, opt_ext, new_trap=new_trap)
    agg_path = paths['agg_path']
    p0_bead = p0_bead_dict[paths['date']]

    ### Open an empty class
    agg_dat = gu.AggregateData([],
                               p0_bead=p0_bead,
                               harms=harms,
                               new_trap=new_trap)

    ### Load the pre-processed AggregateData class
    agg_dat.load(agg_path)
    agg_dat.load_grav_funcs(theory_data_dir)

    # ### A method that helps for grid data, but is unimportant for a single position.
    # ### It still has to be run for the later functions to work
    # agg_dat.bin_rough_stage_positions()

    yuklambdas = agg_dat.gfuncs_class.lambdas
    lambind = np.argmin(np.abs(yuklambdas - yuklambda))

    ### Shit to access the innards of the class for what you want. It retuns an array of
    ### the following shape: (Nfile, Nlambda, n_err+1, 3, 2*nharmonics)
def volume_ndim_ellipsoid(axes):
    ndim = len(axes)
    prefac = np.pi**(float(ndim) / 2.0) / special.gamma(0.5 * float(ndim) + 1)
    return prefac * np.prod(axes)


for ddir in data_dirs:
    # Skip the ones I've already calculated
    #if ddir == data_dirs[0]:
    #    continue
    print()

    paths = gu.build_paths(ddir, opt_ext=opt_ext, new_trap=new_trap)
    p0_bead = p0_bead_dict[paths['date']]

    agg_dat = gu.AggregateData([], p0_bead=p0_bead, harms=harms)
    if load_agg:
        agg_dat.load(paths['agg_path'])
        agg_dat.gfuncs_class.reload_grav_funcs()
        bu.make_all_pardirs(paths['alpha_dict_path'])
        agg_dat.save_alpha_dict(paths['alpha_dict_path'])
        #agg_dat.save_alpha_arr(alpha_arr_path)
    elif load_alpha_arr:
        agg_dat.load_alpha_dict(paths['alpha_dict_path'])

    if load_agg and plot:
        agg_dat.plot_force_plane(resp=0, fig_ind=1, show=False)
        agg_dat.plot_force_plane(resp=1, fig_ind=2, show=False)
        agg_dat.plot_force_plane(resp=2, fig_ind=3, show=True)

    #print(agg_dat.alpha_xyz_dict[0.0][370.0].keys())#.keys())
Esempio n. 5
0
############################################################

############################################################
############################################################

for ddir in data_dirs:

    paths = gu.build_paths(ddir, opt_ext=opt_ext)

    datafiles = bu.find_all_fnames(ddir)
    p0_bead = p0_bead_dict[paths['date']]

    if load_files:
        agg_dat = gu.AggregateData(datafiles, p0_bead=p0_bead, harms=harms, \
                                   elec_drive=True, elec_ind=0, maxfreq=maxfreq, \
                                   plot_harm_extraction=False, dim3=dim3, \
                                   extract_resonant_freq=False,noiselim=(47.0,47.0), \
                                   tfdate=tfdate)
        agg_dat.save(paths['agg_path'])
    else:
        agg_dat = gu.AggregateData([], p0_bead=p0_bead, harms=harms, dim3=dim3, \
                                   tfdate=tfdate)
        agg_dat.load(paths['agg_path'])

    agg_dat.bin_rough_stage_positions(ax_disc=1.0, dim3=dim3)
    agg_dat.handle_sparse_binning(dim3=dim3, verbose=False)

    force_plane_dict = agg_dat.get_vector_force_plane(plot_resp=(0,2), fig_ind=1, \
                                                      plot=True, show=False, \
                                                      sign=[1.0, 1.0, 1.0], dim3=dim3, \
                                                      keyscale=plot_keyscale)