Commit 100c85c8 authored by LUSTIG Peter's avatar LUSTIG Peter

changed fill value

parent 27d688d0
......@@ -105,7 +105,7 @@ def Combine(directory, key, outfile, precision=0.001*u.mJy):
outname))
def MergeToOneTable(directory, key, outfile):
def MergeToOneTable(directory, key, outfile, overwrite=False):
filenames = list(sorted(Path(directory).glob(key)))
minthresh = None
......@@ -115,32 +115,46 @@ def MergeToOneTable(directory, key, outfile):
max_dthresh = 0
header = fits.Header()
print('loading tables')
for i, filename in enumerate(filenames):
print(i)
flux, sources, fsources, dthresh = LoadSingleFile(filename)
header['flux{}'.format(i)] = flux
header['flux{}'.format(i)] = '{}'.format(flux)
sourceslist.append(sources)
fakesourceslist.append(fsources)
if dthresh > max_dthresh:
max_dthresh = dthresh
print('done')
header['dthresh'] = max_dthresh
print('combining measurements')
sources, fake_sources = CombineMeasurements(sourceslist, fakesourceslist)
sources['ID'].fill_value = -999999
sources['fake_sources'].fill_value = -999999
sources['group_id'].fill_value = -999999
fake_sources['ID'].fillvalue = -999999
print('done')
hdul = HDUList([PrimaryHDU(),
BinTableHDU(data=sources, name='detected_sources',
header=header),
BinTableHDU(data=fake_sources, name='fake_sources',
header=header)])
hdul.writeto(outfile)
hdul.writeto(outfile, overwrite=overwrite)
directory = 'montecarlo_results/700/'
directory = ('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/Completness/'
'montecarlo_results/photometry/thresh4')
'montecarlo_results/photometry/partial')
outname = 'allresults_phot_thresh4_Parity0.fits'
key = '*ParityAll*'
Combine(directory, key, outname)
directory = 'montecarlo_results/700/'
directory = ('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/Completness/'
'montecarlo_results/photometry/NewRealisation')
# outname = 'NewrealisationPhotometry.fits'
outname = 'NewrealisationPhotometry.fits'
key = '*'
Combine(directory, key, outname)
# MergeToOneTable(directory, key, outname, overwrite=True)
print('done')
'''
'''
......
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