import view import pandas as pd import logging import pathlib as pl # this tells view all settings including the folder structure of your project # On Windows, if you copy paths from the file explorer, make sure the string below is always of the form r"......" # ymlfile = r"/Volumes/AG_Galizia/AjayramaKumaraswamy/Ana_RNPN_SampleSet/usage_till.yml" ymlfile = r"/home/aj/UKN_network_drives/ag_galizia/AjayramaKumaraswamy/Ana_RNPN_SampleSet/usage_till.yml" # any manual changes to flags, add to dictionary as required flags_to_update = { "RM_ROITrace": 0, # MUST: look up the documentation of this flag # Other flag changes can be included, for example: # CTV_scalebar: True, # mv_individualScale: 2, # ..... } # list of animals for which traces are to be exported animals = [ "A_5803a" ] if __name__ == '__main__': # create a view object view_obj = view.VIEW() # load flags from yml file view_obj.update_flags_from_ymlfile(ymlfile) # update flags specified locally view_obj.update_flags(flags_to_update) # iterate over animals for animal in animals: # initialize view object with animal view_obj.initialize_animal(animal=animal) # initialize and empty data frame to accumulate data gdm_df = pd.DataFrame() # iterate over measurements of the animal for measu in view_obj.get_measus_for_current_animal(analyze_values_to_use=(1,)): # load a measurement for the animal view_obj.load_measurement_data_from_current_animal(measu) # create glodatamix for the loaded measurement gdm_df_this_measu = view_obj.get_glodatamix_for_current_animal() # accumulate gdm_df = gdm_df.append(gdm_df_this_measu, ignore_index=True, sort=False) # compose output file name output_file = view_obj.flags.get_gloDatamix_file_for_current_animal() pl.Path(output_file).parent.mkdir(exist_ok=True) # save gloDatamix file gdm_df.to_csv(output_file, sep=';', header=True, index=False) logging.info(f"Wrote gloDatamix to {output_file}") # backup this script and the yml file used next to the created GDMs view_obj.backup_script_flags_configs_for_GDMs(files=[__file__, ymlfile])