Usage

Once installed (see Installation), QS-2024 can be used in two ways:

  • As a command-line script (CLI), which requires no Python programming and outputs results as files.

  • As a Python package, which allows for more complex workflows and custom analysis.

Both of these methods are described below.

Important

Before using QS-2024, don’t forget to activate the virtual environment where it was installed!

source /path/to/venv/bin/activate

Running from the command line (CLI)

QS-2024 can be run using config files from the command line.

  1. Create a config file

    Config files contain all the information needed to run a QS-2024 absorption model. They are written in the TOML format, and should be named with the .toml extension.

    More information about config files can be found on the Config Files page. Sample config files can be found in the Sample Configs section of that page.

  2. Run the model

    To run the model with the config file, call the qs_2024 script with the path to the config file as an argument:

    qs_2024 /path/to/config.toml
    

    This will save the requested output files specified in the config.

That’s it! That’s all you need to do to run a QS-2024 model from the command line.

Using as a package

QS-2024 can be run as a package from Python programs or Jupyter notebooks.

  1. Import the package

    Import models from the package. An asterisk imports all models, or a specific model can be specified. To see specific model names, see the Model documentation.

    from quantumspectra_2024.models import *   # or a specific model
    
  2. Initialize a Model object

    Create a model object by calling the model’s constructor with all parameters specified:

    model = ModelName(param1=value1, param2=value2, ...)
    
  3. Call the model’s get_absorption() method

    All models come with a get_absorption() method that calculates the absorption spectrum and returns it as a AbsorptionSpectrum object.

    spectrum = model.get_absorption()
    

    This will return an AbsorptionSpectrum instance to the spectrum variable. Details on the AbsorptionSpectrum class can be found in the Absorption Spectrum Docs.

    Accessing spectrum data:

    x, y = spectrum.energies, spectrum.intensities
    print(x)
    print(y)
    

    Saving spectrum data:

    spectrum.save_data("path/to/output/file.csv")
    spectrum.save_plot("path/to/output/plot.png")
    

That’s it! That’s all you need to do to run a QS-2024 model from Python.