Snapshot module#

class mkShapesRDF.processor.modules.Snapshot.Snapshot(tmpOutputFilename, columns, eosPath, outputFilename, includeVariations=True, splitVariations=True, storeNominals=True)[source][source]#

Bases: Module

The Snapshot module handles the creation of the final output files. There are 4 possible scenarios:

  • snapshot nominals only

  • snapshot variations only in separate files (one file per variation)

  • snapshot nominals and variation in separate files (one file per variation and one file for nominal)

  • snapshot both nominals and variations in the same file

The module does not run the snapshotting itself, but it creates the Snapshot objects with lazy evaluation. The snapshots to be run are added to the values variable:

values.append(
    [
        "snapshot",
        SnapshotObject,
        [tmpOutputFilename, copyFromInputFiles , outputFolderPath, outputFilenameEOS]
    ])

Where

  • tmpOutputFilename is the name of the temporary output file,

  • copyFromInputFiles is a boolean that indicates if the auxiliary keys of the input files should be copied in the output (only done for nominals),

  • outputFolderPath is the path of the output folder

  • outputFilenameEOS is the name of the output file in the EOS folder (final output file name)

Methods

CopyFromInputFiles(outputFilename, inputFiles)

Copy the auxiliary keys from the input files into the output file.

SplitVariations(df)

Create a Snapshot object for each variation and tag.

StoreNominals(df)

Create a Snapshot object for the nominal columns.

StoreNominalsAndVariations(df)

Create a Snapshot object containing both nominals and variations.

run(df, values)

No module should overwrite this method.

runModule(df, values)

The main method of the module.

__init__(tmpOutputFilename, columns, eosPath, outputFilename, includeVariations=True, splitVariations=True, storeNominals=True)[source][source]#

Use this constructor to set the name of the module. It should store all the needed information for runModule method.

Parameters:
namestr

Name of the module

static CopyFromInputFiles(outputFilename, inputFiles)[source][source]#

Copy the auxiliary keys from the input files into the output file.

It ``hadd``s the input files into a temporary file, then it copies the keys from the temporary file into the output file.

Parameters:
outputFilenamestr

The name of the output file where to copy the keys (should be equal to tmpOutputFilename)

inputFileslist of str

The list of input files from which to copy the keys

SplitVariations(df)[source][source]#

Create a Snapshot object for each variation and tag.

Parameters:
dfmRDF

The mRDF object to use for snapshot

StoreNominals(df)[source][source]#

Create a Snapshot object for the nominal columns.

Parameters:
dfmRDF

The mRDF object to use for snapshot

StoreNominalsAndVariations(df)[source][source]#

Create a Snapshot object containing both nominals and variations.

Parameters:
dfmRDF

The mRDF object to use for snapshot

runModule(df, values)[source][source]#

The main method of the module. It should contain all the logic of the module.

Parameters:
dfmRDF

The mRDF dataframe

valueslist

List of values that are passed between modules (should contain efficiency of cuts and other values)

Returns:
mRDF

The modified mRDF dataframe