Skip to main content

Input Directly in the Command Line

Input variables can be entered directly in the command line with the -i flag. The -i flag should be provided once for each notebook input, and inputs should be provided in the order in which they appear in the notebook.
Example Usage
Supported Types
There is support for just two types directly in the command line:
  • Scalar (with or without units)
  • Text
  • Use the JSON option for support for more types.

    Input From a JSON File

    The input can also be processed with a JSON file containing the input values. Use the -j flag with the path to your JSON file that contains the inputs.
    Example Usage
    The JSON file must contain a dictionary entry with the key inputs, pointing to an array of the individual notebook inputs. The basic structure of an individual input is as follows:
    Note that description is optional and units may be required, optional, or ignored depending on the type (see Supported Types Supported Types for type specific information). All other fields are required.
    An example of a valid JSON file
    Creating a JSON template
    You can compose your own JSON file in your favorite code editor. Alternatively, use the —template (-t) flag to create input and output template files in JSON that you can modify and pass back in. These files will write to your current directory.
    Example Usage
    or
    Supported Types
    nTop can load boolean, integer, scalar, text, file path, vector, point, and enum input types from a JSON file.

    JSON with input arrays for iterative execution

    There is also an option to provide an array of values, allowing the user to specify multiple sets of inputs, so that the notebook runs once for each set. This provides a particular advantage when the notebook takes a long time to load — this way, it need only be loaded once by nTop, and then it can be run many times. For this option, each input would look like:
    In that case, an example of valid JSON looks like:
    Note that the inputs can be in any order, but each one must be uniquely identified by its name. If two inputs have the same name the behavior is undefined. Also note that when nTop is run with multiple sets of inputs (i.e. with values), each input must contain the same number of values, with the exception that any inputs that are to remain constant for each run can be specified just once. For example, the following input data is valid, and in this case, the notebook is built three times, with a different value for Path and Position on each run, but the same value for Scale and Rotation: