Commit 27d688d0 authored by LUSTIG Peter's avatar LUSTIG Peter

changed data directory, added new function that combines all simulations to one table

parent 08fe2210
......@@ -5,6 +5,7 @@ import astropy.units as u
import numpy as np
import sys
from utils import CombineMeasurements
from astropy.io import fits
def LoadSingleFile(fname):
......@@ -104,13 +105,40 @@ def Combine(directory, key, outfile, precision=0.001*u.mJy):
outname))
def MergeToOneTable(directory, key, outfile):
filenames = list(sorted(Path(directory).glob(key)))
minthresh = None
sourceslist = []
fakesourceslist = []
max_dthresh = 0
header = fits.Header()
for i, filename in enumerate(filenames):
flux, sources, fsources, dthresh = LoadSingleFile(filename)
header['flux{}'.format(i)] = flux
sourceslist.append(sources)
fakesourceslist.append(fsources)
if dthresh > max_dthresh:
max_dthresh = dthresh
header['dthresh'] = max_dthresh
sources, fake_sources = CombineMeasurements(sourceslist, fakesourceslist)
hdul = HDUList([PrimaryHDU(),
BinTableHDU(data=sources, name='detected_sources',
header=header),
BinTableHDU(data=fake_sources, name='fake_sources',
header=header)])
hdul.writeto(outfile)
directory = 'montecarlo_results/700/'
directory = ('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/Completness/'
'montecarlo_results/photometry/thresh4')
outname = 'allresults_phot_thresh4_Parity0.fits'
key = '*ParityAll*'
Combine(directory, key, outname)
'''
......
......@@ -165,8 +165,10 @@ filenamecomment = 'NewRealisation_'
# DATA_DIR_SERVER = Path("/data/NIKA/Reduced/"
# "HLS091828_common_mode_one_block/v_1")
DATA_DIR_SERVER = Path("/data/NIKA/Reduced/May2018/"
"HLS091828_common_mode_one_block/v_1/")
# DATA_DIR_SERVER = Path("/data/NIKA/Reduced/May2018/"
# "HLS091828_common_mode_one_block/v_1/")
DATA_DIR_SERVER = Path("/data/NIKA/Reduced/May2018/HLS091828_atm_and"
"_all_box_iter_IterativeMM_CosSinElevOffset/v_1")
DATA_DIR_MYPC = Path("/home/peter/Dokumente/Uni/Paris/Stage/data/v_1")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment