Skip to content

Commit

Permalink
v1.0 (#248)
Browse files Browse the repository at this point in the history
* update

* update

* update

* update

* update

* read MCNP table 126 (#250)

Co-authored-by: Luca Fiorito <lfiorito@sckcen.be>

* Update unit_test.yml

* update

* Fix sampling unit tests (#252)

* update

* update

* update

* update

* update

* update

* update

* update

---------

Co-authored-by: Fiorito Luca <luca.fiorito@sckcen.be>
Co-authored-by: Luca Fiorito <lfiorito@sckcen.be>

* faster get_cov implementation (#259)

* Update test_notebooks.yml

* removed 'eval' from spectra.py

* Pendf apply pert (#263)

Apply pert to xs

* update doc string (#264)

* Fix meta stables (#265)

* update

* update

* update

* update

* update

* update

* update

* Update endf6.py

* Implement comment

* Rename sampling.py to endf6.py

* Comment failing test

Failing assertion in sampling.run test is commented

* comment implementation

---------

Co-authored-by: Di Croce Federico <Federico.Di.Croce@sckcen.be>

* Fix tests (#257)

* update

* update

* update

* update

* update

* update

* update

* update

---------

Co-authored-by: Fiorito Luca <luca.fiorito@sckcen.be>
Co-authored-by: Luca Fiorito <lfiorito@sckcen.be>

* Fix get_cov() (#266)

* update

* update

* update

* update

* update

* update

* update

* Update errorr.py

---------

Co-authored-by: Di Croce Federico <Federico.Di.Croce@sckcen.be>

* Fix Cov symmetry check (#272)

* update

* update

* update

* update

* update

* update

* update

---------

Co-authored-by: Di Croce Federico <Federico.Di.Croce@sckcen.be>

* remove fortran (#267)

* update

* update

* update

* update

* update

* update

* update

* update

* update

---------

Co-authored-by: Luca Fiorito <lfiorito@sckcen.be>
Co-authored-by: Fiorito Luca <luca.fiorito@sckcen.be>

* svd notebook (#273)

Co-authored-by: Fiorito Luca <luca.fiorito@sckcen.be>

* Update test_notebooks.yml

* Update test_notebooks.yml

* perturb nubar (#274)

* update

* update

* update

---------

Co-authored-by: Luca Fiorito <lfiorito@sckcen.be>

* Fix sampling (#275)

* update

* update

* Update cov.py

---------

Co-authored-by: Luca Fiorito <lfiorito@sckcen.be>

* added notebook multivariate (#276)

* update

* update

---------

Co-authored-by: Luca Fiorito <lfiorito@sckcen.be>

* Iterate xs samples (#277)

* update

* update

---------

Co-authored-by: Luca Fiorito <lfiorito@sckcen.be>

* update (#278)

* update

* update

* update

---------

Co-authored-by: Luca Fiorito <lfiorito@sckcen.be>

* update

* Create bump_version.yml

* Update bump_version.yml

* update release

* update release

* Update release.yaml

* Update release.yaml

* Update release.yaml

* change version

* fix setup

* Create deploy_api_docs.yml

* Update make_docs.sh

---------

Co-authored-by: Luca Fiorito <lfiorito@sckcen.be>
Co-authored-by: Fiorito Luca <luca.fiorito@sckcen.be>
Co-authored-by: fdcroce <122983386+fdcroce@users.noreply.github.com>
Co-authored-by: Di Croce Federico <Federico.Di.Croce@sckcen.be>
  • Loading branch information
5 people committed Jul 7, 2023
1 parent 2fe433e commit efe35bf
Show file tree
Hide file tree
Showing 155 changed files with 5,369 additions and 2,059,992 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/release.yaml
Expand Up @@ -13,6 +13,11 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
# The branch, tag or SHA to checkout. When checking out the repository that
# triggered a workflow, this defaults to the reference or SHA for that event.
# Otherwise, defaults to `master`.
ref: 'develop'
- name: Setup Python
uses: actions/setup-python@v2
with:
Expand All @@ -25,6 +30,6 @@ jobs:
run: python setup.py sdist bdist_wheel
- name: Publish
env:
TWINE_USERNAME: __token__
TWINE_USERNAME: ${{ secrets.PYPI_TEST_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }}
run: twine upload dist/*
run: twine upload dist/* --verbose
8 changes: 5 additions & 3 deletions .github/workflows/test_notebooks.yml
Expand Up @@ -25,10 +25,10 @@ jobs:
# The branch, tag or SHA to checkout. When checking out the repository that
# triggered a workflow, this defaults to the reference or SHA for that event.
# Otherwise, defaults to `master`.
ref: 'develop'
ref: 'v1.0'
- uses: actions/setup-python@v3
with:
python-version: "3.7.15"
python-version: "3.x"

# Run commands using the runners shell
- name: clone and install njoy
Expand All @@ -39,6 +39,8 @@ jobs:
run: pip install sphinx sphinx_rtd_theme codecov numpydoc coveralls pytest-cov nbval
- name: install sandy's requirements
run: pip install -r requirements.txt
- name: install jupyter packages to run notebooks
run: pip install jupyterlab matplotlib seaborn
- name: install sandy
run: python setup.py install --user
- name: run notebooks
Expand All @@ -58,4 +60,4 @@ jobs:
destination-repository-name: 'sandy_notebooks'
user-email: lucafiorito.11@gmail.com
commit-message: pushing notebooks...
target-branch: executed_notebooks
target-branch: executed_notebooks_v1.0
4 changes: 2 additions & 2 deletions .github/workflows/unit_test.yml
Expand Up @@ -6,9 +6,9 @@ name: CI
on:
# Triggers the workflow on push or pull request events but only for the develop branch
push:
branches: [ develop ]
branches: [ develop, v1.0 ]
pull_request:
branches: [ develop ]
branches: [ develop, v1.0 ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
188 changes: 60 additions & 128 deletions INSTALL.md
@@ -1,20 +1,52 @@
# Installation
# Installation and configuration

## Download
## Installation on Windows/Linux with pip/conda
The recommended way to install SANDY both on Windows and Linux is on an Anaconda virtual environment that already includes several python packages. Click [here](#anaconda) for more details on Anaconda.

The source code of SANDY is available as a git repository. The recommended way to get SANDY is by cloning the source package using your local git distribution (*click [here](https://git-scm.com/downloads) to download it!*).
We advise to install the SANDY dependences in a python environment that was not previously altered. You can do so from a terminal/Anaconda Prompt using the package/environment management system `conda` included in Anaconda, as
```sh
conda update --name base conda
conda create -y --name sandy-devel -c conda-forge python numpy scipy pandas pyyaml pytables
```
This environment covers all hard dependencies of SANDY, but i usually like to add a few more packages (such as `ipython`) depending on my goal:
- data analysis and visualization: `matplotlib`, `seaborn`, `scikit-learn`
- testing: `pytest`, `numpydoc` , `nbval`, `codecov`, `coveralls`, `pytest-cov`
- packaging projects: `build`, `twine`
- jupyter notebooks: `jupyterlab`, `jupyter_nbextensions_configurator`, `jupyter_contrib_nbextensions`

From now on, every time you want to use SANDY in your python distribution you need to activate the correct environemt.
```sh
git clone https://github.com/luca-fiorito-11/sandy.git
cd sandy
conda activate sandy-devel
```
... and the following to deactivate it.
```sh
conda deactivate
```
To manage your python environments read the [conda cheatsheet](https://docs.conda.io/projects/conda/en/4.6.0/_downloads/52a95608c49671267e40c689e0bc00ca/conda-cheatsheet.pdf).

If a `SSL Certificate problem` appears when pushing or pulling with git, one can tell git to not perform the validation of the certificate using the global option:
Once the virtual environment is set up and active, you can install SANDY with `pip`.

```git
git config --global http.sslVerify false
```sh
pip install -i https://test.pypi.org/simple/ sandy
```

> This distribution is only temporarily available on a separate instance of the [Python Package index](https://test.pypi.org/project/sandy/).
## Running SANDY in a python shell
1. Open a terminal/Anaconda Prompt.
2. Switch to the correct python environment (if any).
3. Type `python` or `ipython` to open up a python/ipython session.
4. Then type
```python
import sandy
```

Now, if `sandy` is available you are ready to roll!

Still, many of the features of SANDY require running NJOY.
Here we assume that


## Installation using Anaconda

### Downloading Anaconda
Expand All @@ -23,33 +55,20 @@ The recommended way to install the SANDY requirements (especially on Windows) is
### Getting started with Anaconda
The user guide to get yourself acquainted with Anaconda is available [here](https://docs.anaconda.com/anaconda/user-guide/). On a Windows machine we recommend that you use the Anaconda Prompt terminal.

### Installing SANDY
# Installation from source
The source code of SANDY is available as a git repository. The recommended way to get SANDY is by cloning the source package using your local git distribution (*click [here](https://git-scm.com/downloads) to download it!*).

#### Creating a clean virtual environment using conda (not mandatory, but recommended)
We advise to install the SANDY dependences in a python environment that was not previously altered. You can do so from a terminal/Anaconda Prompt using the package/environment management system `conda` included in Anaconda, as
```sh
conda update --name base conda
conda create -y --name sandy-devel -c conda-forge python=3.7 jupyterlab jupyter_nbextensions_configurator jupyter_contrib_nbextensions
git clone https://github.com/luca-fiorito-11/sandy.git
cd sandy
```
I like to include jupyterlab to my environment!

Then, dependences are installed from the requirement file,
```sh
conda install --force-reinstall -y --name sandy-devel -c conda-forge --file requirements_conda.txt
```
Make sure you are in the folder `sandy` that you cloned with git and where file `requirements_conda.txt` is located.
If a `SSL Certificate problem` appears when pushing or pulling with git, one can tell git to not perform the validation of the certificate using the global option:

From now on, every time you want to use SANDY in your python distribution you need to activate the correct environemt.
```sh
conda activate sandy-devel
```
... and the following to deactivate it.
```sh
conda deactivate
```git
git config --global http.sslVerify false
```
To manage your python environments read the [conda cheatsheet](https://docs.conda.io/projects/conda/en/4.6.0/_downloads/52a95608c49671267e40c689e0bc00ca/conda-cheatsheet.pdf).

#### Working without a virtual environment
Move to the folder `sandy` that you cloned with git and install the requirements

**with conda**
Expand All @@ -64,100 +83,41 @@ pip install -r requirements.txt

> The difference between files `'requirements.txt'` and `'requirements_conda.txt'` is all in how they call the python package `pytables`. For more info have a look at the pytables [installation website](https://www.pytables.org/usersguide/installation.html). If you are aware of a better way of doing it, please get in touch with us!
### Installation using `setup.py`
SANDY is still using some fortran (hopefully not for long!), which is compiled with the `f2py` module of `numpy`. For that an updated C++ compiler and a Fortran compiler are needed.

**on Linux**
We just assume the compilers mentioned above are available. Then, once you are in the folder `sandy`, run the installation command,
```sh
python setup.py install
```
> Don't forget to activate the virtual environment if you are using one.
**on Windows**

For the C++ compiler, [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) are recommended. Once the download has completed follow these steps:
1. Launch the Visual Studio Build Tools installation wizard.
2. In the `Workloads` tab select the `C++ build tools package` and click on `Install`.
3. A reboot of your machine is requested.

For the Fortran compiler do the following:
1. Open the `Anaconda Navigator` from the start menu.
2. Select `sandy-devel` or `base (root)` in the `Environments` tab, respectively if you created or not a virtual environment.
3. On the top widget change the selection from `Installed` to `All`.
4. In the `Search Packages` box type *fortran*.
3. Make sure that `m2w64-gcc-fortran` and `m2w64-gcc-libgfortran` are selected and then click on `Apply` on the bottom right-side.
4. Click once again on the `Apply` button in the pop-up window to accept package modifications (dependencies).

Once the C++ compiler and the Fortran compiler are installed, open an Anaconda Prompt terminal, activate the virtual environment (if any) and install SANDY as
```sh
conda activate sandy-devel
python setup.py install
```

Go to the `site-packages` directory containing the installed python packages. You can find this directory running the following inside a python shell:
```python
from distutils.sysconfig import get_python_lib
print(get_python_lib())
```
It should be something like `C:\path\to\Anaconda\envs\sandy-devel\Lib\site-packages` (or `C:\path\to\Anaconda\Lib\site-packages`if you don't work with a virtual environment).

There you should find a *python egg* for SANDY, that is, a folder named `sandy-*.egg`. If you move to folder `.\rwf\.libs` inside the SANDY egg you'll see that some `librwfortra.*.gfortran-win_*.dll` files were created during the installation. Copy such `*.dll` files at the root level of the SANDY egg (`C:\path\to\Anaconda\envs\sandy-devel\Lib\site-packages\sandy-*.egg` or `C:\path\to\Anaconda\Lib\site-packages\sandy-*.egg`)

Now SANDY should work also on Windows! If it still doesn't, some dependencies might be missing (you might see an import module error). In that case, try the following:
1. Download a [software](https://visualstudio.microsoft.com/visual-cpp-build-tools/) to scan module dependencies.
2. Open `DependenciesGui.exe` and load the `*.pyd` file of the module SANDY is failing to import. Missing dependencies (DLL files) will appear with a `?` sign.
3. Search for the missing dependencies on your PC and copy them to the same directory where the `*.pyd` file of the failing module is located.
4. Good luck!

### Adding SANDY to PYTHONPATH
If you want to add the `sandy` folder to your `PYTHONPATH` you can do
Now you can simply add the `sandy` folder to your `PYTHONPATH` and you are ready to go.

**in Linux**
```sh
export PYTHONPATH="/path/to/sandy:${PYTHONPATH}"
```
Add the previous command to your `${HOME}/.bashrc` or `${HOME}/.bash_profile` file to make your changes permanent.
> Add the previous command to your `${HOME}/.bashrc` or `${HOME}/.bash_profile` file to make your changes permanent.
**in Windows**
```dos
set PYTHONPATH=%PYTHONPATH%;C:\path\to\sandy
```
or, if you want the changes to be permanent,
```dos
setx PYTHONPATH="%PYTHONPATH%;C:\path\to\sandy" /m
```

> Alternatively, use the environment variable editor in **Control panel** &rarr; **View advanced system settings**.
## Running a python shell
1. Open a terminal/Anaconda Prompt.
2. Switch to the correct python environment (if any).
3. Type `python` or `ipython` to open up a python/ipython session.
4. Then type
```python
import sandy
Alternatively, you can add sandy to the python packages of your environent (although not necessary). Then, once you are in the folder `sandy`, run the installation command,
```sh
python setup.py install --user
```
> Don't forget to activate the virtual environment if you are using one.
Now, if `sandy` is available you are ready to roll!
SANDY is installed! Now go back to run it in a python shell.

## Testing SANDY
A number (far away from being extensive enough) of unit tests is available to test that SANDY works correctly. First, make sure you istalled the following packages
If you installed SANDY from source you can test if it works correctly by runnning a number (far away from being extensive enough) of unit tests. First, make sure you istalled the following packages

**with Anaconda**
```sh
conda install -y --name sandy-devel -c conda-forge numpydoc nbval
```

**with pip**
```sh
pip install numpydoc nbval
```

Then, you can run the tests from a terminal/Anaconda Prompt from the `sandy` folder with
```sh
conda activate sandy-devel
pytest sandy
mkdir tests
cd tests
pytest ../sandy
```

Hopefully they are all green!
Expand All @@ -175,7 +135,7 @@ python -m ipykernel install --user --name sandy-devel --display-name "Python3 (s

## Running SANDY with NJOY
SANDY also works as a wrapper to the NJOY code to process nuclear data files into PENDF and ACE formats.
The installation of NJOY is not mandatory, but recommended.
The installation of NJOY is not mandatory (it is if you want to produce random samples), but recommended.

We suggest using NJOY2016 (we haven't tried NJOY2021 yet!).
You can find the source on its [github repository](https://github.com/njoy/NJOY2016).
Expand Down Expand Up @@ -230,11 +190,6 @@ Then, you have to add `C:\path\to\cygwin64\bin` (or the location where `cygwin1.
```dos
set PATH=%PATH%;C:\path\to\cygwin64\bin
```
or, if you want the changes to be permanent,
```dos
setx PATH="%PATH%;C:\path\to\cygwin64\bin" \m
```

> Again, the environment variable editor in the control panel can also be used.

Expand Down Expand Up @@ -263,27 +218,4 @@ To check if NJOY works you can:
* make sure `C:\path\to\cygwin64\bin` is in your list of environemnt variables (juste type `set` and look at `Path`);
* run `C:\path\to\cygwin64\home\your_username\NJOY2016\bin\njoy.exe`.

NJOY should now be running in your terminal!

## `git` branches
The development of SANDY is mostly carried out on the `git` branch `develop`. In this branch you should have the latest features available. We recommend using this branch if you want to use SANDY as an interface to nuclear data files. All SANDY tutorials available [here](https://luca-fiorito-11.github.io/sandy_notebooks/) were produced with the `develop` branch and might not work on other branches.

The `master` branch was originally developed for creating random perturbed files of evaluated nuclear data libraries. If this is your objective, that is, you could't care less of how SANDY works and just want some results, then you should use the `git` branch `master`.

To have a list of the available branches open a `git` shell, move to the `sandy` folder and type,
```git
git branch --list
```

If you want to switch to, say, the `master` branch type
```git
git checkout master
```

If SANDY is already installed on your PC and you know that changes were made on the corresponding remote version on github you don't to clone the code once again. Just move to the `sandy` folder and do
```git
git pull
```
from the selected branch.

If any conflict appear, then it is probably time to read the `git` [documentation](https://git-scm.com/doc).
NJOY should now be running in your terminal!
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

0 comments on commit efe35bf

Please sign in to comment.