validphys.scripts package
Submodules
validphys.scripts.main module
Created on Tue Mar 1 10:29:41 2016
@author: Zahari Kassabov
validphys.scripts.postfit module
postfit - fit output processing tool
postfit constructs a final PDF fit ensemble and LHAPDF set from the output of a batch of nnfit jobs. The jobs are assessed on the basis of standard NNPDF fit veto criteria as described in the validphys fitveto module. Passing replicas are symlinked to the [results]/postfit directory in the standard NNPDF layout and also in the standard LHAPDF layout.
- exception validphys.scripts.postfit.FatalPostfitError[source]
Bases:
Exception
Exception raised when some corrupted input is detected
- exception validphys.scripts.postfit.PostfitError[source]
Bases:
Exception
Exception raised when postfit cannot succeed and knows why
- validphys.scripts.postfit.filter_replicas(postfit_path, nnfit_path, fitname, chi2_threshold, arclength_threshold, integ_threshold)[source]
Find the paths of all replicas passing the standard NNPDF fit vetoes as defined in fitveto.py. Returns a list of the replica directories that pass.
- validphys.scripts.postfit.relative_symlink(source, dest)[source]
Forms a relative symlink between ‘source’ and ‘dest’
validphys.scripts.vp_checktheory module
A script which utilises the validphys loader method check_theoryinfo to allow user to quickly print table to terminal.
Example
$ vp-checktheory 53
will print the info of theory 53 to terminal
$ vp-checktheory 53 –dumptable
in addition to printing the theory info table will save the table to csv in the current working directory with the name theory_<theoryid>_info.csv
$ vp-checktheory –fit NNPDF31_nlo_as_0118
will parse the theoryid from supplied fit, downloading the fit if required.
Notes
User can either specify theoryid as a positional argument or –fit FIT but not both at the same time.
validphys.scripts.vp_comparefits module
- class validphys.scripts.vp_comparefits.CompareFitApp(name='validphys', providers=['validphys.results', 'validphys.commondata', 'validphys.pdfgrids', 'validphys.pdfplots', 'validphys.dataplots', 'validphys.fitdata', 'validphys.arclength', 'validphys.sumrules', 'validphys.reweighting', 'validphys.kinematics', 'validphys.correlations', 'validphys.chi2grids', 'validphys.eff_exponents', 'validphys.asy_exponents', 'validphys.paramfits.dataops', 'validphys.paramfits.plots', 'validphys.theorycovariance.construction', 'validphys.theorycovariance.output', 'validphys.theorycovariance.tests', 'validphys.replica_selector', 'validphys.closuretest', 'validphys.mc_gen', 'validphys.theoryinfo', 'validphys.pseudodata', 'validphys.renametools', 'validphys.covmats', 'validphys.hyperoptplot', 'validphys.deltachi2', 'validphys.n3fit_data', 'validphys.mc2hessian', 'reportengine.report', 'validphys.overfit_metric'])[source]
Bases:
App
- get_config()[source]
Create and initialize the Config object containing the user input.
This default implementation parses the YAML configuration from the config file given as first mandatory argument in the command line. However it can be overriden, often together with
get_positional_args
to e.g. load the config from a mapping.
validphys.scripts.vp_deltachi2 module
- class validphys.scripts.vp_deltachi2.HyperoptPlotApp(name='validphys', providers=['validphys.results', 'validphys.commondata', 'validphys.pdfgrids', 'validphys.pdfplots', 'validphys.dataplots', 'validphys.fitdata', 'validphys.arclength', 'validphys.sumrules', 'validphys.reweighting', 'validphys.kinematics', 'validphys.correlations', 'validphys.chi2grids', 'validphys.eff_exponents', 'validphys.asy_exponents', 'validphys.paramfits.dataops', 'validphys.paramfits.plots', 'validphys.theorycovariance.construction', 'validphys.theorycovariance.output', 'validphys.theorycovariance.tests', 'validphys.replica_selector', 'validphys.closuretest', 'validphys.mc_gen', 'validphys.theoryinfo', 'validphys.pseudodata', 'validphys.renametools', 'validphys.covmats', 'validphys.hyperoptplot', 'validphys.deltachi2', 'validphys.n3fit_data', 'validphys.mc2hessian', 'reportengine.report', 'validphys.overfit_metric'])[source]
Bases:
App
- get_config()[source]
Create and initialize the Config object containing the user input.
This default implementation parses the YAML configuration from the config file given as first mandatory argument in the command line. However it can be overriden, often together with
get_positional_args
to e.g. load the config from a mapping.
validphys.scripts.vp_fitrename module
vp-fitrename - command line tool to rename fits
vp-fitrename allows for command line renaming of fits. To do so, call vp-fitrename with a path to the original fit and the requested new fit. The optional flags allow for preserving a copy of the original fit and also to change fits in the NNPDF results directory.
validphys.scripts.vp_get module
NNPDF resource downloader. The basic syntax is
vp-get <resource_type> <resource_name>
Use
vp-get –list
to see a list of resource types. If the resource is already installed, a string with its name will be printed to stdout. If not, it will be searched in the remote repositories and installed if found.
validphys.scripts.vp_hyperoptplot module
- class validphys.scripts.vp_hyperoptplot.HyperoptPlotApp(name='validphys', providers=['validphys.results', 'validphys.commondata', 'validphys.pdfgrids', 'validphys.pdfplots', 'validphys.dataplots', 'validphys.fitdata', 'validphys.arclength', 'validphys.sumrules', 'validphys.reweighting', 'validphys.kinematics', 'validphys.correlations', 'validphys.chi2grids', 'validphys.eff_exponents', 'validphys.asy_exponents', 'validphys.paramfits.dataops', 'validphys.paramfits.plots', 'validphys.theorycovariance.construction', 'validphys.theorycovariance.output', 'validphys.theorycovariance.tests', 'validphys.replica_selector', 'validphys.closuretest', 'validphys.mc_gen', 'validphys.theoryinfo', 'validphys.pseudodata', 'validphys.renametools', 'validphys.covmats', 'validphys.hyperoptplot', 'validphys.deltachi2', 'validphys.n3fit_data', 'validphys.mc2hessian', 'reportengine.report', 'validphys.overfit_metric'])[source]
Bases:
App
- get_config()[source]
Create and initialize the Config object containing the user input.
This default implementation parses the YAML configuration from the config file given as first mandatory argument in the command line. However it can be overriden, often together with
get_positional_args
to e.g. load the config from a mapping.
validphys.scripts.vp_list module
vp-list
Script which lists available resources locally and remotely
- validphys.scripts.vp_list.natural_keys(text)[source]
sort a list according to natural ordering http://nedbatchelder.com/blog/200712/human_sorting.html
taken directly from https://stackoverflow.com/a/5967539
validphys.scripts.vp_nextfitruncard module
vp-nextfitruncard
Command line tool to produce the runcard for an iterated fit given the input fit.
The script: - Takes the input fit as a required argument and loads its runcard - Updates the description of the fit interactively - Uses the input fit as the t0 set - Modifies the random seeds to values between 0 and 2**32 - 1 (max size of unsigned long int) - Updates the preprocessing exponents - Writes the runcard for the iterated fit to the current working directory, unless a different path
is given as an argument
Note that the runcard is written as long as it does not already exist in the path. This can be overridden by using the –force flag
validphys.scripts.vp_pdffromreplicas module
vp-pdffromreplicas
Take a pre-existing source PDF
with MC replicas and create a new PDF
with replicas subsampled from the source PDF
. Replicas will be sampled
uniformly.
source PDF
will be downloaded if it cannot be found locally.
This script will not overwrite any existing files, so a PDF
cannot already
exist with the same name as the output PDF
.
Note that whilst in principle it is possible to create a single replica PDF
,
some applications might rely on the existence of 2 members (in addition to replica 0).
To handle this special case if replicas == 1
, then replica 2 will be a duplicate of replica
1, satisfying the minimum number of replicas whilst retaining the property
that replica 1 and replica 0 are identical.
validphys.scripts.vp_pdfrename module
vp-pdfrename - command line tool to rename LHAPDFs
To obtain the PDF from an fit, simply run vp-pdfrename <path-to-fit> <PDF name>. Optional flags allow for the resulting pdf to be placed in the LHAPDF directory, as well as modifying various fields of the info file. In addition, it is possible to compress the resulting PDF also using tar archiving.
- validphys.scripts.vp_pdfrename.compress(lhapdf_path: Path)[source]
Function to compress the resulting PDF. Dereferences are handled in order to account for possible symbolic linking of grids.
- validphys.scripts.vp_pdfrename.fixup_ref(pdf_path: Path, field_dict)[source]
Function to handle alterations of the info file. The argparser namespace is read in as a dictionary which is then used to write to the resulting output file.
If the user did not provide a field then we revert to the pre existing field.
validphys.scripts.vp_upload module
Upload a resource to the NNPDF server.
The script automatically detects (validphys.uploadutils.check_input()
)
the type of the input.
A
fit
is defined to be any folder structure that contains afilter.yml
file at its rootA
hyperscan
is afit
that containstries.json
file without apostfit
folder.a
.info
file at the root and a replica 0a report is any such structure containing an
index.html
file at the root.
The input folder is then placed in the correct location in the server accordingly.
validphys.scripts.wiki_upload module
A more interactive version of vp_upload