Commit fabef1f8 authored by LUSTIG Peter's avatar LUSTIG Peter
Browse files

update...

parent 4d15fef8
......@@ -249,7 +249,8 @@ class CatalogShifter(object):
transform: callable or None.
If not None, takes coord_in_center and rotation as argument
and transforms them to a :class:`astropy.coordinates.SkyCoord`
and an angle that are used as coord_in_center and rotation.
and an angle that are used as coord_in_center and rotation to
perform transformation.
Returns
-------
catalog : :class:``astropy.table.Table``
......
......@@ -6,21 +6,22 @@ import numpy as np
import sys
from utils import CombineMeasurements
from astropy.io import fits
from astropy.utils.console import ProgressBar
def LoadSingleFile(fname):
_file = open(fname)
flux = u.Quantity(_file[0].header['influx'])
with open(fname) as _file:
flux = u.Quantity(_file[0].header['influx'])
try:
sources = Table.read(_file['DETECTED_SOURCES'])
except KeyError:
print('no sources detected for {}'.format(flux))
sources = None
try:
sources = Table.read(_file['DETECTED_SOURCES'])
except KeyError:
print('no sources detected for {}'.format(flux))
sources = None
fsources = Table.read(_file['FAKE_SOURCES'])
fsources = Table.read(_file['FAKE_SOURCES'])
dthresh = _file[0].header['DTHRESH']
dthresh = _file[0].header['DTHRESH']
return flux, sources, fsources, dthresh
......@@ -116,22 +117,23 @@ def MergeToOneTable(directory, key, outfile, overwrite=False):
header = fits.Header()
print('loading tables')
for i, filename in enumerate(filenames):
print(i)
flux, sources, fsources, dthresh = LoadSingleFile(filename)
header['flux{}'.format(i)] = '{}'.format(flux)
sourceslist.append(sources)
fakesourceslist.append(fsources)
if dthresh > max_dthresh:
max_dthresh = dthresh
with ProgressBar(len(filenames)) as pg:
for i, filename in enumerate(filenames):
flux, sources, fsources, dthresh = LoadSingleFile(filename)
header['flux{}'.format(i)] = '{}'.format(flux)
sourceslist.append(sources)
fakesourceslist.append(fsources)
if dthresh > max_dthresh:
max_dthresh = dthresh
pg.update()
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
sources['ID'].fill_value = -999999999
sources['fake_sources'].fill_value = -999999999
fake_sources['find_peak'].fill_value = -999999999
fake_sources['ID'].fillvalue = -999999999
print('done')
hdul = HDUList([PrimaryHDU(),
......@@ -149,11 +151,18 @@ directory = 'montecarlo_results/700/'
directory = ('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/Completness/'
'montecarlo_results/photometry/NewRealisation')
# outname = 'NewrealisationPhotometry.fits'
outname = 'NewrealisationPhotometry.fits'
directory = ('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/Completness/'
'testdir/test/')
directory = '/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/Completness/montecarlo_results/Newrealisation/detection'
directory = '/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/Completness/montecarlo_results/Newrealisation/photometry'
# outname = ('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/Completness/'
# 'PhotometryNewrealisation3.5_MultTables.fits')
directory = '/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/Completness/montecarlo_results/Newrealisation/2mm/realdetection'
outname = '/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/Completness/montecarlo_results/Newrealisation/2mm/AllRealdetections.fits'
key = '*'
Combine(directory, key, outname)
# MergeToOneTable(directory, key, outname, overwrite=True)
# Combine(directory, key, outname)
MergeToOneTable(directory, key, outname, overwrite=False)
print('done')
'''
......
......@@ -7,16 +7,22 @@ from astropy.wcs import WCS
import warnings
import sys
sys.path.append('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/Completness')
from fitmodels import ModifiedErrorFunction , FluxRelativeBoosting
from fitmodels import ModifiedErrorFunction, FluxRelativeBoosting, FluxBoosting
from astropy.modeling.fitting import LevMarLSQFitter
from pathlib import Path
from utils import find_nearest
from astropy.wcs.utils import proj_plane_pixel_area
plt.close('all')
def ChiSquaredPerNDF(x, y, yerr, fitfunc):
return np.sum((y - fitfunc(x))**2 / (yerr**2)) / len(x)
# Get number of free parameters
npar = 0
for key in fitfunc.fixed.keys():
npar += not fitfunc.fixed[key]
return np.sum((y - fitfunc(x))**2 / (yerr**2)) / (len(x)-npar)
......@@ -127,10 +133,12 @@ class BasicEvaluation:
self.fake_sources = None
self.shape = shape
self.wcs = wcs
self.mask = mask
def PlotMask(self, sourcecat=None, fluxdeviation=None, **kwargs):
mask = self.mask
wcs = self.wcs
ax, img = Plot2D(np.array(mask, dtype=int), wcs=wcs, xlabel='Ra',
ylabel='Dec', **kwargs)
......@@ -144,6 +152,20 @@ class BasicEvaluation:
c=fluxdeviation, label='Sources')
return ax, img
def Surface(self):
mask = self.mask
wcs = self.wcs
surfpix = np.prod(self.shape)
if mask is not None:
surfpix = np.sum(~mask)
surface = surfpix * proj_plane_pixel_area(wcs) * (u.deg**2)
return surface.to(u.arcminute**2)
class CompletenessArea(BasicEvaluation):
def __init__(self, sources, fake_sources=None,
......@@ -162,6 +184,7 @@ class CompletenessArea(BasicEvaluation):
self.sources = sources
self.fake_sources = fake_sources
self.shape = shape
self.wcs = wcs
fake_sourceslocmask = np.zeros(len(fake_sources), dtype=bool)
sourceslocmask = np.zeros(len(sources), dtype=bool)
......@@ -183,7 +206,7 @@ class CompletenessArea(BasicEvaluation):
def ChangeMask(self, mask):
self.__init__(self.sources, self.fake_sources,
shape=self.shape, wcs=None,
shape=self.shape, wcs=self.wcs,
threshold_edges=self.threshold_edges,
flux_edges=self.flux_edges,
flux_centers=self.flux_centers, mask=mask)
......@@ -237,7 +260,7 @@ class CompletenessArea(BasicEvaluation):
return constfluxinterp, constthreshinterp
def FitCompleteness(self, idx, constant='thresh', fitmodel=None,
weighted=False):
weighted=True):
if constant == 'thresh':
y = self.completeness[:, idx]
......@@ -284,7 +307,7 @@ class CompletenessArea(BasicEvaluation):
ax1 = self.PlotCompleteness1D(idx, constant=constant, marker='o',
ax=ax1, linestyles=['None'])
plotx = np.linspace(x[0], x[-1], 100)
plotx = np.geomspace(x[0], x[-1], 1000)
ax1.plot(plotx, res(plotx), color='r', label='Fit')
leg = ax1.legend(loc=legloc, title='SNR', fontsize=20, edgecolor='k')
plt.setp(leg.get_title(), fontsize=20)
......@@ -314,7 +337,7 @@ class CompletenessArea(BasicEvaluation):
ax2.set_xlabel('Flux [mJy]', fontsize=20)
ax2.set_xscale('log')
return res, [ax1, ax2]
return (res, fitter), [ax1, ax2]
def PlotCompleteness1D(self, idx, constant='flux', linestyles=None,
ax=None, **kwargs):
......@@ -416,6 +439,7 @@ class CountsAreaEvaluation(BasicEvaluation):
self.sources = sources
self.shape = shape
self.mask = mask
self.wcs = wcs
sourceslocmask = np.zeros(len(sources), dtype=bool)
if mask is not None:
......@@ -431,7 +455,7 @@ class CountsAreaEvaluation(BasicEvaluation):
self.counts = self.Counts()
def ChangeMask(self, mask):
self.__init__(sources=self.sources, shape=self.shape, wcs=None,
self.__init__(sources=self.sources, shape=self.shape, wcs=self.wcs,
threshold_edges=self.threshold_edges, no_sim=self.no_sim,
mask=mask)
......@@ -476,7 +500,7 @@ class FluxArea(CompletenessArea):
self.__init__(sources=self.sources,
fake_sources=self.fake_sources,
shape=self.shape, wcs=None,
shape=self.shape, wcs=self.wcs,
threshold_edges=self.threshold_edges,
flux_edges=self.flux_edges,
flux_centers=self.flux_centers,
......@@ -513,47 +537,84 @@ class FluxArea(CompletenessArea):
perc = np.zeros((len(bins)-1, len(percentiles)))
mean = np.zeros(len(bins)-1)
mean_var = np.zeros(len(bins)-1)
var = np.zeros(len(bins)-1)
center = np.zeros(len(bins)-1)
abs_mean = np.zeros(len(bins)-1)
abs_mean_var = np.zeros(len(bins)-1)
# fluxcenter = np.zeros(len(bins)-1)
for i in range(0, len(bins)-1):
binmask = binidx != (i + 1)
totmask = binmask | fake_sources['find_peak'].mask | locmask
tmp = np.array(fluxdeviation[~totmask])
_det_flux = outflux[~totmask]
# should maybe add a center error. Creates need of 2D error fit.
# -> use fine binning to keep error small and neglect it
center[i] = np.mean(xval[~totmask])
if len(tmp) > 5:
perc[i] = np.nanpercentile(tmp, percentiles)
mean[i] = np.mean(tmp)
var[i] = np.var(tmp) / len(tmp)
mean[i] = np.nanmean(tmp)
var[i] = np.nanvar(tmp)
mean_var[i] = var[i] / len(tmp)
abs_mean[i] = np.nanmean(_det_flux)
abs_mean_var[i] = np.nanvar(_det_flux) / len(tmp)
else:
perc[i] = np.repeat(np.nan, len(percentiles))
mean[i] = np.nan
var[i] = np.nan
mean_var[i] = np.nan
abs_mean[i] = np.nan
abs_mean_var[i] = np.nan
self.snrbins = snrbins
self.fluxpercentiles = perc
self.fluxmean = mean
self.fluxmean_unc = np.sqrt(var)
self.fluxmean_unc = np.sqrt(mean_var)
self.fluxmean_absolute = abs_mean
self.fluxmean_absolute_unc = np.sqrt(abs_mean_var)
self.flux_unc = np.sqrt(var)
self.percentile_center = center
return perc, snrbins
def FitFluxboost(self, weighted=False, model=None, asfunctionof='flux'):
def FitFluxboost(self, weighted=True, model=None, asfunctionof='flux',
relative=True, mincompleteness=.1):
y = self.fluxmean
y_err = self.flux_unc
x = self.flux_centers.to_value(u.mJy)
y_err = self.fluxmean_unc
x = self.percentile_center
ylabel = r'$F_{\mathrm{out}} / F_{\mathrm{in}}$'
boxloc = .97, 0.95
if not relative:
y = self.fluxmean_absolute
y_err = self.fluxmean_absolute_unc
ylabel = r'$F_{\mathrm{out}}$'
legloc = 'upper left'
boxloc = .53, 0.95
if self.snrbins is not None:
x = self.snrbins
if model is None:
model = FluxRelativeBoosting(1, 1)
if not relative:
model = FluxBoosting(1, 1)
fitter = LevMarLSQFitter()
# Only use fluxes for fit with a minimum of sources detected
compmask = self.completeness[:, 0] < mincompleteness
fitx = x[~compmask]
fity = y[~compmask]
fity_err = y_err[~compmask]
if weighted:
res = fitter(model, x, y, weights=1./y_err)
res = fitter(model, fitx, fity, weights=1./fity_err)
else:
res = fitter(model, x, y)
res = fitter(model, fitx, fity)
# create plot
# Layout
......@@ -565,22 +626,39 @@ class FluxArea(CompletenessArea):
ax2 = fig.add_axes([left, bottom, right-left,
(top-bottom) * fraction], sharex=ax1)
# plot
ax1 = self.PlotPercentiles(ax=ax1)
plotx = np.linspace(x[0], x[-1], 100)
ax1.plot(plotx, res(plotx))
ax2.errorbar(x, y - res(x), linestyle='None')
ax2.axhline(0)
# plot fit
plotx = np.geomspace(x[0], x[-1], 1000)
ax1.errorbar(x, y, yerr=y_err, linestyle='None', marker='o')
ax1.plot(plotx, res(plotx), color='r')
chi2 = ChiSquaredPerNDF(x, y, y_err, res)
fitboxprops = dict(facecolor='white', edgecolor='black',
boxstyle='round, pad=.3', alpha=1)
Sderr, sigmaerr = np.sqrt(fitter.fit_info['param_cov'].diagonal())
fitboxtext = (r'$F_{\mathrm{out}} / F_{\mathrm{in}} = \mathrm{boost}(F_0,\sigma)$' + '\n')
fitboxtext += r'$\chi^2/\mathrm{{ndf}}={:.2f}$'.format(chi2) + '\n'
fitboxtext += r'$F_0={:.3f}\pm{:.3f}$'.format(res.Sd.value, Sderr) + '\n'
fitboxtext += r'$\sigma={:.3f}\pm{:.3f}$'.format(res.sigma.value, sigmaerr)
#%matplotlib tk
ax1.text(*boxloc, fitboxtext, ha='right', va='top', bbox=fitboxprops,
transform=ax1.transAxes, fontsize=20, ma='left')
# Residuals
ax2.errorbar(x, y - res(x), yerr=y_err, linestyle='None', marker='o')
ax2.axhline(0, color='r')
# modify labels
ax1.set_title('Fluxboost', fontsize=25, y=1.02)
ax1.set_ylabel(ylabel, fontsize=20)
ax1.tick_params(axis='both', labelsize=15)
ax2.tick_params(axis='both', labelsize=15)
ax2.set_xlabel(r'$F_{\mathrm{in}}$ [mJy / beam]', fontsize=20)
ax2.set_ylabel('Comp-Fit', fontsize=20)
ax2.tick_params(axis='both', labelsize=15)
ax2.set_ylabel('Residuals', fontsize=20)
ax2.set_xscale('log')
return res, [ax1, ax2]
return (res, fitter), [ax1, ax2]
def PlotPercentiles(self, exact=True, ax=None, mean=False, **kwargs):
percentiles = np.copy(self.fluxpercentiles).T
......@@ -701,7 +779,7 @@ def LogBinEdges(LogBinCenters):
class Purity:
def __init__(self, absolute_counts, false_counts, thresholds):
pur = (abs_counts - false_counts) / abs_counts
pur = (absolute_counts - false_counts) / absolute_counts
self.thresholds = thresholds
self.purity = pur
......@@ -719,12 +797,13 @@ class Purity:
return ax
# %%
# %matplotlib tk
if __name__=='__main__':
showcompletness = False
showcompletness = True
showfalsecounts = False
showrealcounts = True
showflux = True
showflux = False
maskfilename = ('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/'
'Completness/masks.fits')
......@@ -807,7 +886,7 @@ if __name__=='__main__':
# helper = plt.legend.DraggableLegend()
fig.subplots_adjust(wspace=.05, bottom=0.16, left=0.08, right=0.98,
top=0.9)
# SaveFigure(fig, 'Completness_fixed_thresholds')
SaveFigure(fig, 'Completness_fixed_thresholds')
obj.InterpolateThresholds(0.8)
# %%
......@@ -903,14 +982,16 @@ if __name__=='__main__':
obj.Plot2D(nthreshlabels=6)
# %matplotlib tk
idx = 0
ax = obj.PlotCompleteness1D(idx, constant='thresh')
f, axes = obj.FitCompleteness(idx=idx, constant='thresh')
# ax = obj.PlotCompleteness1D(idx, constant='thresh')
# f, axes = obj.FitCompleteness(idx=idx, constant='thresh')
# %matplotlib tk
obj.PlotPercentiles(mean=True)
obj.flux_unc
obj.ChangeMask(totmask)
obj.fluxmean_unc
# obj.ChangeMask(totmask)
# %matplotlib tk
ff, (ax1, ax2) = obj.FitFluxboost()
ff, (ax1, ax2) = obj.FitFluxboost(weighted=True)
x = np.linspace(.1, 10, 1000)
# tf = FluxRelativeBoosting(1,1)
# ax1.plot(x, tf(x))
......
......@@ -25,11 +25,13 @@ from mpl_toolkits.axes_grid1 import make_axes_locatable
import dill as pickle
from matplotlib.ticker import FormatStrFormatter
from collections import OrderedDict
sys.path.append('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/Completness')
from utils import completness_purity_wcs, completness_worker, purity_worker
from utils import find_nearest, DeletePercentiles
from utils import pos_in_mask, Flux1D
from astropy.units import Quantity
# plt.close('all')
class PCEvaluation:
def __init__(self, sources, fake_sources=None, realsources=None,
......@@ -415,7 +417,6 @@ class PCAreaEvaluation:
self.fluxpercentiles = np.zeros((len(sources), 5))
for iflux in range(len(sources)):
print('loop {}'.format(iflux))
_sources = AddXYCoordinatesTo(sources[iflux], wcs)
if fake_sources is not None:
......@@ -812,10 +813,12 @@ if __name__ == '__main__':
sh = data.data.shape
oldwcs = data.wcs
if 1:
if 0:
#completnessareafile = ('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/'
# 'Completness/allresults_phot_thresh4.fits')
completnessareafile = ('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/'
'Completness/allresults_phot_thresh4.fits')
'Completness/PhotometryNewrealisation3.5_MultTables.fits')
pflux, psources, pfsources = UglyLoader(completnessareafile)
exc = 5
......@@ -833,9 +836,8 @@ if __name__ == '__main__':
#bb = PCAreaEvaluation(mask=globmask, sources=sources, wcs=wcs, nsim=nsim,
# realsources=realsources, flux=pflux, fake_sources=None,
# threshold_range=(2.5, 10), threshold_bins=50)
'''
# %%
# % matplotlib tk
plt.figure(figsize=(8, 7))
bb.PlotCounts()
plt.xlim(xmin=2.5, xmax=5)
......@@ -848,11 +850,6 @@ if __name__ == '__main__':
# % matplotlib tk
bb.PlotPercentiles()
plt.show(block=True)
# %%
#bb.FitFluxResolution(10*u.mJy)
#bb.FitFluxResolution(5*u.mJy)
#bb.FitFluxResolution(1*u.mJy)
# plt.show(block=True)
'''
......@@ -872,16 +869,19 @@ if __name__ == '__main__':
aa.PlotDarkcountsThresholds()
plt.show(block=True)
'''
if 0:
if 1:
# %matplotlib tk
fname = ('/home/peter/Dokumente/Uni/Paris/Stage/'
'FirstSteps/Completness/NEWcombined_tables_long.fits')
fname = ('/home/peter/Dokumente/Uni/Paris/Stage/'
'FirstSteps/Completness/NEW_combine_fct_result.fits')
fname = ('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/'
'Completness/PhotometryNewrealisation3.5_MultTables.fits')
FLUX, SOURCE, FSOURCE = UglyLoader(fname)
if 0:
# %matplotlib tk
if 1:
xx = PCEvaluation(SOURCE, FSOURCE, shape=sh, wcs=oldwcs, flux=FLUX,
mapbins=19, threshold_bins=6,
threshold_range=(2.5, 5))
......@@ -894,19 +894,34 @@ if __name__ == '__main__':
ylabel='Purity')
xx.PlotOverview(flux=5*u.mJy)
xx.PlotHitmap(flux=5*u.mJy)
if 0:
plt.close('all')
# %%
%matplotlib tk
# xx.thresholds
fig = plt.figure()
plt.imshow(xx.completness[27, :, :, 2], origin='lower')
50-23
plt.imshow(xx.completness[37, :, :, 2], origin='lower')
if 1:
fluxidxs = [27, 25, 23, 21, 19, 17, 15, 13, 11, 29]
fluxidxs = np.arange(11, 50, 2)
threshidxs = [2]*len(fluxidxs)
_hdul = [fits.PrimaryHDU()]
_hdul.append(fits.ImageHDU(data=xx.completness[-3, :, :, -2],
name='CompletnessMap'))
_hdul[1].header['flux'] = '{}'.format(xx.flux[-3])
_hdul[1].header['dthresh'] = '{}'.format(xx.thresholds[-2])
_hdul[1].header.extend(xx.wcs_3D.sub([1, 2]).to_header())
for ii, (fluxidx, threshidx) in enumerate(zip(fluxidxs, threshidxs)):
_hdul.append(fits.ImageHDU(data=xx.completness[fluxidx, :, :, threshidx],
name='CompletenessBinned{}'.format(ii)))
_hdul[1+ii].header['flux'] = '{}'.format(xx.flux[fluxidx])
_hdul[1+ii].header['dthresh'] = xx.thresholds[threshidx]
_hdul[1+ii].header.extend(xx.wcs_3D.sub([1, 2]).to_header())
_hdul = fits.HDUList(_hdul)
_hdul.writeto('CompletnessBinnedMapExample.fits',
_hdul.writeto('/home/peter/Dokumente/Uni/Paris/Stage/'
'FirstSteps/Completness/'
'CompletnessBinnedMapExampleNew.fits',
overwrite=True)
if 1:
if 0:
yy = PCEvaluation(SOURCE, FSOURCE, shape=sh, wcs=oldwcs, flux=FLUX,
mapbins=9, threshold_bins=6,
threshold_range=(2.5, 5))
......@@ -916,7 +931,7 @@ if __name__ == '__main__':
yy.PlotFixedThreshold(yy.GetPurityBin(4, 4), np.array([3, 5]),
ylabel='Purity')
plt.show(block=True)
# plt.show(block=True)
'''
fname = ('/home/peter/Dokumente/Uni/Paris/Stage/'
......
import numpy as np
import matplotlib.pyplot as plt
import sys
import astropy.units as u
from astropy.table import Table
from astropy.io import fits
from astropy.wcs import WCS
sys.path.append('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/Completness')
from completness2d import CompletenessArea, LogBinEdges, ChiSquaredPerNDF
from completness2d import ModifiedErrorFunction, LevMarLSQFitter, SaveFigure
#%autoreload 2
# Load HLS mask
maskfilename = ('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/'
'Completness/masks.fits')
with fits.open(maskfilename) as hdul:
hitmask = hdul['hitmask'].data.astype(bool)
hlsmask = hdul['hls3fwhm'].data.astype(bool)
wcs = WCS(hdul['hitmask'].header)
# Load SNR masks
anothermaskfile = ('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/verify/'
'snrmasks_fine_new.fits')
snrmasks = []
with fits.open(anothermaskfile) as hdul:
i = 0
while True:
try:
hdu = hdul['SNRMASK{}'.format(i)]
snrmasks.append(hdu.data.astype(bool))
if i == 0:
wcs = WCS(hdu.header)
shape = hdu.data.shape
except KeyError:
break
i += 1
# Load Monte Carlo Data
filename = ('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/'
'Completness/DetectionNewrealisationPixmeans.fits')
#filename = ('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/Completness/'
# 'montecarlo_results/Newrealisation/2mm/AllRealdetections.fits')
# DetectionNewrealisationPixmeans.fits
with fits.open(filename) as hdul:
sources = Table.read(hdul, 'DETECTED_SOURCES')
fake_sources = Table.read(hdul, 'FAKE_SOURCES')
fluxedges = LogBinEdges(fake_sources['amplitude']) * u.Jy
fluxcenters = u.Quantity(np.squeeze(np.sort(np.unique(
fake_sources['amplitude']))))
threshbins = np.arange(2.5, 4.501, .01)
threshbins = np.linspace(2.5, 10, 1001)