Skip to content

Commit

Permalink
Check on duplicates + if error
Browse files Browse the repository at this point in the history
  • Loading branch information
Elisa-Visentin committed Sep 4, 2023
1 parent de86308 commit 11e40c6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
20 changes: 16 additions & 4 deletions nsb_scripts/LSTnsb.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,28 @@ def main():
nsb_limit.insert(0,0)
print(nsb_limit)
lst_config='lstchain_standard_config.json'
LST_files=np.sort(glob.glob(f'LST_[1-4]*.txt'))
with open(runs) as LSTfile:
LST_runs = np.genfromtxt(LSTfile,dtype=str,delimiter=',')
if len(LST_runs)==2:
if (len(LST_runs)==2) and (len(LST_runs[0])==1):

LST=LST_runs

LST_runs=[]
LST_runs.append(LST)

print(LST_runs)

for i in LST_runs:
for i in LST_runs:
print(i)
duplicate=False
for k in LST_files:
with open(k) as myfl:
if f'{i[0]},{i[1]}' in myfl.read():
print('run already processed')
duplicate=True
continue
if duplicate==True:
continue
lstObsDir = i[0].split("_")[0]+i[0].split("_")[1]+i[0].split("_")[2]
inputdir = f'/fefs/aswg/data/real/DL1/{lstObsDir}/v0.9/tailcut84'
run = np.sort(glob.glob(f"{inputdir}/dl1*Run*{i[1]}.*.h5"))
Expand Down
10 changes: 5 additions & 5 deletions nsb_scripts/nsb_coincident_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,23 @@ def linking_lst(target_dir, LST_runs, nsb, date):
if not os.path.exists(coincidence_DL1_dir+"/Coincident/"+str(nsb)):
os.mkdir(f"{coincidence_DL1_dir}/Coincident/{nsb}")

if len(LST_runs)==2:
if (len(LST_runs)==2) and (len(LST_runs[0])==1):

LST=LST_runs

print(LST)
LST_runs=[]
LST_runs.append(LST)

print(LST_runs)
dt=date
date=[]
date.append(dt)


for i in LST_runs:


print(i[0].split('_'))
lstObsDir = i[0].split("_")[0]+i[0].split("_")[1]+i[0].split("_")[2]

print('ok')
inputdir = f'/fefs/aswg/data/real/DL1/{lstObsDir}/v0.9/tailcut84'
outputdir = f'{coincidence_DL1_dir}/Coincident/{nsb}/{lstObsDir}'
list_of_subruns = np.sort(glob.glob(f"{inputdir}/dl1*Run*{i[1]}*.*.h5"))
Expand Down
4 changes: 2 additions & 2 deletions nsb_scripts/nsb_setting_up_config_and_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def lists_and_bash_gen_MAGIC(target_dir, telescope_ids, MAGIC_runs):
f.write('ulimit -l unlimited\n')
f.write('ulimit -s unlimited\n')
f.write('ulimit -a\n')
if len(MAGIC_runs)==2:
if (len(MAGIC_runs)==2) and (len(MAGIC_runs[0])==1):

MAGIC=MAGIC_runs

Expand Down Expand Up @@ -179,7 +179,7 @@ def directories_generator(target_dir, telescope_ids,MAGIC_runs):
###########################################
##################### MAGIC
###########################################
if len(MAGIC_runs)==2:
if (len(MAGIC_runs)==2) and (len(MAGIC_runs[0])==1):

MAGIC=MAGIC_runs

Expand Down

0 comments on commit 11e40c6

Please sign in to comment.