Commit 39bd319a authored by Alice Donini's avatar Alice Donini
Browse files

update script DL1 to DL2

parent a9f941de
Loading
Loading
Loading
Loading
+20 −5
Original line number Diff line number Diff line
@@ -29,9 +29,17 @@ final_run_list = pd.DataFrame(columns=['path'])

# if txt file with runs and nights is given, use that instead search in the database
if args.runlist is not None:
    rl = np.genfromtxt(open(args.runlist, 'r'), usecols=(0,1), dtype=int)
    runlist = os.environ.get('CONFIG_FOLDER') + '/' + args.runlist
    rl = np.genfromtxt(open(runlist, 'r'), usecols=(0, 1), dtype=int)
    n_element = np.count_nonzero(rl)
    if n_element == 2:
        runs = np.array([rl[0]])
        nights = np.array([rl[1]])
    else:
        runs = rl[:, 0]
        nights = rl[:, 1]
    # runs = rl[:,0]
    # nights = rl[:,1]
    # nights = []
    # for run in rl:
    #     night = database_file.loc[run, 'day']
@@ -49,6 +57,7 @@ else:
        final_run_list = pd.concat([final_run_list, run_list])

if args.verbose:
    print('')
    print("Final run list to be analysed:")
    print(final_run_list)

@@ -58,6 +67,12 @@ out_dir = config_file['base_dir'] + '/DL2/' + args.source_name
# path to model directory
models = config_file['path_models']

# custom lstchain config file
if 'lstchain_config' in config_file:
    config_lstchain = config_file['lstchain_config']
else:
    config_lstchain = None

# check if output directory exists, if not, create it
if not (os.path.isdir(out_dir)):
    try:
@@ -83,7 +98,7 @@ if args.runlist is not None:
        --input-file {dl1_file} \
        --output-dir {dl2_output_path} \
        --path-models {models}' \
        + ['', f' --config {args.config_analysis}'][args.config_analysis is not None]
        + ['', f' --config {config_lstchain}'][config_lstchain is not None]

        # Send interactive, sbatch or dry run
        if args.verbose:
@@ -113,7 +128,7 @@ else:
            f'--output-dir {dl2_output_path} '
            f'--path-models {models} '
        ) \
            + ['', f' --config {args.config_analysis}'][args.config_analysis is not None]
            + ['', f' --config {config_lstchain}'][config_lstchain is not None]

        # Send interactive, sbatch or dry run
        if args.verbose:
+8 −7
Original line number Diff line number Diff line
@@ -13,17 +13,18 @@ base_dir: /fefs/aswg/workspace/alice.donini/Analysis/data

# Path to personal directory where output data will be saved.
# Uncomment and modify in case you want to use a non standard path
#output_folder: ../DL2/Crab

# Directory where config files are stored
#config_folder: ./
# Otherwise files will be saved to {base_dir}/DL2/{source_name/{night}/{version}/{cleaning}
#dl2_output_folder: ../DL2/Crab

# Path to trained RF files
path_models: ../models

# Uncomment and modify in case you want to specify a custom configuration file for the lstchain script
# lstchain_config: lstchain_84.json

# Values for automatic selection of DL1 data
dl1_data:
  DL1_dir: /fefs/aswg/data/real/DL1     # path to DL1 directory
  night: [20210911, 20210912]           # day(s) of observation (more than one is possible)
  version: v0.9.1                       # v0.7.3, v0.8.4, v0.9, v0.9.1
  version: v0.9                         # v0.7.3, v0.8.4, v0.9
  cleaning: tailcut84
  # uncomment the line below and specify the nights only if database search is used and not a custom runlist file
  #night: [20210911, 20210912]           # day(s) of observation (more than one is possible)