Python package for calculating Westcott
This project can be built and installed by running the installation.sh script at the terminal command line of the project directory:
$ git clone https://github.com/DMatters/WestcottFactors.git
$ cd WestcottFactors
$ sh installation.shAs an alternative the project can also be installed via pip since it is being concurrently maintained on the Test instance of the Python Package Index repository https://test.pypi.org/project/westcott/
pip install -i https://test.pypi.org/simple/ westcottA suite of Python modules containing unit tests has been developed for this project. These unit tests are located in the tests folder. To run the suite and ensure they work with the local Python environment, run tox in the project directory where the tox.ini file is also located:
$ tox -rThis project has the following Python-package dependencies: numpy, scipy, pandas, and pytest. The session is automatically started after building against the required Python environment.
Following installation, the westcott scripts can be ran from any location by importing the library and making an instance of the Westcott class:
$ python>>> import westcott
>>> gw = westcott.Westcott()Various Jupyter Notebooks are provided in the notebooks folder to demonstrate workflows and methods for interacting with the functionality available to the library.
All westcott classes and methods have supporting docstrings. Please refer to the individual dosctrings for more information on any particular function including how to use it. The dosctrings for each method generally have the following structure:
- A short explanation of the function.
- A list and description of arguments that need to be passed to the function.
- The return value of the function.
- Exceptions that may be raised.
- An example(s) invoking use of the function.
To retrieve a list of all available methods simply execute the following command in a Python interpreter:
>>> help(gw)Or, to retrieve the docstring for a particular method, e.g., the callable gw_Maxwellian to calculate the g-factor assuming a Maxwellian spectrum:
>>> help(gw.gw_Maxwellian)[1] D.A. Matters, A.M. Hurst, T. Kawano, "Westcott g Factors Extended to Arbitrary Neutron Energy Spectra", https://doi.org/10.48550/arXiv.2602.05995