File: python_setup.md

package info (click to toggle)
baler 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 207,900 kB
  • sloc: python: 2,468; sh: 98; makefile: 7
file content (68 lines) | stat: -rw-r--r-- 2,687 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
## Python Setup
A setup for windows is available [here](documentation/setup/python_setup_windows.md)

For some Linux users, disable the KDE keyring
```console
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
```

1. Install [poetry](https://python-poetry.org/) for managing the python environment. 

2. Clone this repository and move into the project
```console
git clone https://github.com/baler-collaboration/baler.git && cd baler
```

3. Install dependencies using Poetry
```console
poetry install
```

4. Try the installation with `poetry run baler`, this should give the following output:

```console
usage: baler [-h] --mode MODE --project WORKSPACE PROJECT [--verbose]
baler: error: the following arguments are required: --mode, --project
```

## Working Example with Python

Here we provide some instructions for our working examples.

### Computational Fluid Dynamics Example

#### Training ####
To train the autoencoder to compress your data, you run the following command. The config file `./workspaces/CFD_workspace/CFD_project_v1/config/CFD_project_v1_config.py`. This details the path of the data, the number of epochs, and all the other training parameters.
```console
poetry run baler --project CFD_workspace CFD_project_animation --mode train
```

#### Compressing ####
To use the derived model for compression, you can now choose ``--mode compress``, which can be run as

```console
poetry run baler --project CFD_workspace CFD_project_animation --mode compress
```
This will output a compressed file called "compressed.pickle", and this is the latent space representation of the input dataset. It will also output cleandata_pre_comp.pickle which is just the exact data being compressed.

#### Decompressing ####
To decompress the compressed file, we choose --mode decompress and run:
```console
poetry run baler --project CFD_workspace CFD_project_animation --mode decompress
```

#### Plotting ####
To plot the difference of your variables before compression and after decompression, we can use the following command to generate a .pdf document under ``./workspaces/firstWorkspace/firstProject/output/plotting/comparison.pdf``

```console
poetry run baler --project CFD_workspace CFD_project_animation --mode plot
```

### High Energy Physics Example ###
To run our High Energy Physics using CMS data (DOI:10.7483/OPENDATA.CMS.KL8H.HFVH) follow the above instructions but replace `--project CFD_workspace CFD_project_animation` with `--project CMS_workspace CMS_project_v1`

## New project ##
To create the folder structure and a skeleton config for your own project:
```console
poetry run baler --project firstWorkspace firstProject --mode newProject
```