コード例 #1
0
def downloader(studio, seeds, ampls, angles, tunes, exp_turns, np, setenv=True, deletedata=False):
    """routine that downloads all the data and stacks it up in a dedicated dictionary"""
    set_env_castor(setenv)  # set environment variables for castor
    CASTOR_HOME = os.environ.get("CASTOR_HOME") + "/direct_track/"

    file_list = pre_stage_castor(CASTOR_HOME, studio, seeds, ampls, angles, tunes, exp_turns)
    delayer(file_list)
    os.system("rm %s" % file_list)

    tbt_data = {}  # turn by turn data container
    part = 0
    i = 0

    for mad_seed in seeds:
        pID_bias = 0
        bunch = {}
        for amp in ampls:
            for angle in angles:
                dest_path = get_data_from_castor(CASTOR_HOME, studio, mad_seed, amp, angle, tunes, exp_turns)
                head, part = read_allfortbin(pID_bias, basedir="./%s" % dest_path)
                i = i + 1
                pID_bias = np * i
                bunch.update(part)
                if deletedata:
                    remove_data(dest_path)
        tbt_data[mad_seed] = bunch

    return tbt_data
コード例 #2
0
ファイル: castor_script.py プロジェクト: skostogl/SixDeskDB
def downloader(studio,
               seeds,
               ampls,
               angles,
               tunes,
               exp_turns,
               np,
               setenv=True,
               deletedata=False):
    '''routine that downloads all the data and stacks it up in a dedicated dictionary'''
    set_env_castor(setenv)  #set environment variables for castor
    CASTOR_HOME = os.environ.get('CASTOR_HOME') + '/direct_track/'

    file_list = pre_stage_castor(CASTOR_HOME, studio, seeds, ampls, angles,
                                 tunes, exp_turns)
    delayer(file_list)
    os.system('rm %s' % file_list)

    tbt_data = {}  #turn by turn data container
    part = 0
    i = 0

    for mad_seed in seeds:
        pID_bias = 0
        bunch = {}
        for amp in ampls:
            for angle in angles:
                dest_path = get_data_from_castor(CASTOR_HOME, studio, mad_seed,
                                                 amp, angle, tunes, exp_turns)
                head, part = read_allfortbin(pID_bias,
                                             basedir='./%s' % dest_path)
                i = i + 1
                pID_bias = np * i
                bunch.update(part)
                if (deletedata):
                    remove_data(dest_path)
        tbt_data[mad_seed] = bunch

    return tbt_data
コード例 #3
0
def data_to_dictionary(main_folder, folder_name, folder_max_number):
    """routine that reads all the data and stacks it up in a dedicated dictionary
	"""

    tbt_data = {}  # turn by turn data container

    np = 60

    pID_bias = 0
    bunch = {}
    for n in range(folder_max_number + 1):
        dest_path = os.getcwd() + "/" + main_folder + "/" + folder_name + str(n)
        print dest_path
        head, part = read_allfortbin(pID_bias, basedir="%s" % dest_path)
        pID_bias = np * (n + 1)
        print "pID_bias=", pID_bias
        bunch.update(part)
        print "the tbt data read for this particle is long", len(part)
        # tbt_data[mad_seed]=bunch
        # tbt_data=bunch
    closo = head["closorb"]

    return bunch, closo