Ejemplo n.º 1
0
def create_filereports(file_data_dicts, event, destination, current_trial, trial_doc_folder, default_folder):
    """Creates reports without interfacing with the files
    themselves."""
    for file_ in file_data_dicts:
        pubChan = "%s_%s_%s" % (file_[cfg_fl_net], file_[cfg_fl_sta], file_[cfg_fl_chan])
        channel_data_dict = smysql.retrieve_channel_position(pubChan, event[cfg_evt_time])

        report.append_report_if_valid(trial_doc_folder, file_, channel_data_dict, event[cfg_evt_evid])
Ejemplo n.º 2
0
def create_filereports(file_data_dicts, event, destination, current_trial, trial_doc_folder, default_folder):
    mysqldb                 = bui.conn    
    for file_ in file_data_dicts:
        pubChan                 = "%s_%s_%s" % (file_[cfg_fl_net], 
                                                file_[cfg_fl_sta], 
                                                file_[cfg_fl_chan])
        channel_data_dict       = mysqldb.retrieve_channel_position(pubChan, 
                                                                    event[cfg_evt_time])
             
        report.append_report_if_valid(trial_doc_folder, 
                                      file_, 
                                      channel_data_dict, 
                                      event[cfg_evt_evid])
Ejemplo n.º 3
0
def move_datafiles(file_data_dicts, 
                   event, 
                   destination, 
                   current_trial, 
                   trial_doc_folder, 
                   default_folder, 
                   expnum):
    '''Moves datafile from mysql-descripted location to file structure.
    file_                   = mySQL-created dictionary that hold data location info.
    event                   = Dictionary containing event information for the event that "file_" belongs to.
    destination             = Location of Experiment file structure as defined by configuration
    current_trial           = Actually is the trial number that is being worked on.
    trial_doc_folder        = Location of Documentation Files for the event. '''
    mysqldb                 = bui.conn
    julian_folder           = datetime.datetime.utcfromtimestamp(event['time']).strftime(data_retrieval_time_format)

    # Upload every file associated with event.
    for file_ in file_data_dicts:
        filename                = file_[cfg_fl_dfile]
        oscommand_source        = "%s%s%s" % (default_folder, julian_folder, filename)
        oscommand_destination   = "%sTrial-%s/Rep-1/" % (destination, current_trial)
        pubChan                 = "%s_%s_%s" % (file_[cfg_fl_net], file_[cfg_fl_sta], file_[cfg_fl_chan])
        channel_data_dict       = mysqldb.retrieve_channel_position(pubChan, event[cfg_evt_time])
        file_extensions         = utils.find_extensions(oscommand_source)            

        report.append_report_if_valid(trial_doc_folder, 
                                      file_, 
                                      channel_data_dict, 
                                      event[cfg_evt_evid])

        utils.copy_file_exts(oscommand_source, 
                             oscommand_destination, 
                             file_extensions)

        upload_and_post(expnum, 
                        current_trial, 
                        oscommand_destination, 
                        filename, 
                        file_extensions)