validphys.scripts package

Submodules

validphys.scripts.main module

Created on Tue Mar 1 10:29:41 2016

@author: Zahari Kassabov

validphys.scripts.main.main()[source]

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.main()[source]

Forms a relative symlink between ‘source’ and ‘dest’

validphys.scripts.postfit.set_lhapdf_info(info_path, nrep)[source]

Sets the LHAPDF info file NumMembers field

validphys.scripts.postfit.splash()[source]
validphys.scripts.postfit.type_fitname(fitname: str)[source]

Ensure the sanity of the fitname

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_checktheory.main()[source]

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.eff_exponents', 'validphys.asy_exponents', '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', 'validphys.hessian2mc'])[source]

Bases: App

add_positional_arguments(parser)[source]
complete_mapping()[source]
get_commandline_arguments(cmdline=None)[source]
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.

interactive_author()[source]
interactive_current_fit()[source]
interactive_current_fit_label()[source]
interactive_keywords()[source]
interactive_reference_fit()[source]
interactive_reference_fit_label()[source]
interactive_thcovmat_if_present()[source]

Interactively fill in the use_thcovmat_if_present runcard flag. Which is True by default

interactive_title()[source]
try_complete_args()[source]
validphys.scripts.vp_comparefits.main()[source]

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.eff_exponents', 'validphys.asy_exponents', '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', 'validphys.hessian2mc'])[source]

Bases: App

add_positional_arguments(parser)[source]

Wrapper around argumentparser

complete_mapping()[source]
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.main()[source]

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_fitrename.main()[source]
validphys.scripts.vp_fitrename.process_args()[source]

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.

class validphys.scripts.vp_get.ListAction(*args, loader, **kwargs)[source]

Bases: Action

validphys.scripts.vp_get.main()[source]

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.eff_exponents', 'validphys.asy_exponents', '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', 'validphys.hessian2mc'])[source]

Bases: App

add_positional_arguments(parser)[source]

Wrapper around argumentparser

complete_mapping()[source]
get_commandline_arguments(cmdline=None)[source]
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_hyperoptplot.main()[source]

validphys.scripts.vp_list module

vp-list

Script which lists available resources locally and remotely

validphys.scripts.vp_list.atoi(text)[source]

convert string to integer, if possible

validphys.scripts.vp_list.main(command_line=None)[source]
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_nextfitruncard.interactive_description(original_description)[source]

Set description of fit interactively. The description of the input fit is used as default.

validphys.scripts.vp_nextfitruncard.main()[source]
validphys.scripts.vp_nextfitruncard.process_args()[source]

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_pdffromreplicas.check_none_or_gt_one(value)[source]

Check the value supplied can be interpreted as an integer and is greater than one.

Returns:

supplied value cast to integer.

Return type:

int

validphys.scripts.vp_pdffromreplicas.main()[source]

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_pdfrename.main()[source]
validphys.scripts.vp_pdfrename.process_args()[source]

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 a filter.yml file at its root

  • A hyperscan is a fit that contains tries.json file without a postfit folder.

  • a PDF is any folder containing a .info file at the root and a replica 0

  • a 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.vp_upload.main()[source]

validphys.scripts.wiki_upload module

A more interactive version of vp_upload

validphys.scripts.wiki_upload.edit_settings(d)[source]
validphys.scripts.wiki_upload.handle_meta_interactive(output)[source]
validphys.scripts.wiki_upload.handle_single_file(filename)[source]
validphys.scripts.wiki_upload.main()[source]

Module contents