xpipe.xhandle.parbins.XIO¶
- class xpipe.xhandle.parbins.XIO(lenses, randoms=None, params=None, dirpaths=None, nrandoms=None, force_centers=100)[source]¶
XSHEAR style input file creator
- Parameters
lenses (dict) – dictionary with lens data
randoms (dict, optional) – dictionary with random points data
params (dict) – Pipeline settings in a dictionary format. If
None
then the defaultpaths.params
will be useddirpaths (dict) – Pipeline directory paths in a dictionary format. If
None
then the defaultpaths.dirpaths
will be usednrandoms (float or int) – number of random points to draw for each parameter bin with replacement. If
None
then the value is extracted frompaths.params
force_centers (int or np.array) – number of JackKnife centers, or the (RA, DEC) positions of the centers
Notes
If
nrandoms == -1
then all random points are used, and no random draw is made. In this case the weights are not applied properly, so be careful!Examples
Using default parameters specified in
paths.params
.load catalogs:
lenses = parbins.prepare_lenses() randoms = parbins.prepare_random()
initiate object:
xio = parbins.XIO(lenses, randoms)
create project directory:
xio.mkdir()
loop over all parameter bins:
xio.loop_bins(norands=args.norands)
write logfile, for future reference:
logfile = xio.dpath + '/' + paths.params['tag'] + '_params.p' pickle.dump(paths.params, open(logfile, 'wb'))
- loop_bins(norands=False, match=True)[source]¶
Loops over (lambda, z) parameter bins and save xshear input files
- Parameters
norands (bool) – Flag to skip random points, default
False
, (that is to include randoms)match (bool) – Flag to match the random point distribution by their paramters to the lens distribution. The alternative is to just apply the parameter cut without further matching.
- randsel(match=True)[source]¶
Selects random points to use (weighted draw with replacement)
If
self.nrandoms == -1
then all random points are used, and no random draw is made. In this case the weights are not applied properly, so be careful!- Parameters
match (bool) – Flag to match the random point distribution by their paramters to the lens distribution. The alternative is to just apply the parameter cut without further matching.