Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 37 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,49 @@

This repository contains the back-end of the [Virtual FTIR Spectrometer](https://github.com/RastonLab/Virtual-FTIR-Spectrometer).

## [api](https://github.com/RastonLab/Virtual-FTIR-Functions/tree/main/api)
## Flask

This directory contains
- `app.py`

- Contains a program that accepts API calls for both spectrum generation and background sample generation. This program accepts JSON through a `fetch()` or `cURL` command and returns JSON of X and Y coordinates.

- `background.py`
- Contains a program that strictly generates a background sample. This program uses `data.json` for its input and is capable of graphing using `mathplotlib`.
- `fast_api.py`
- Contains a program that accepts API calls for both a background sample and spectrum. This program accepts JSON through a `fetch()` or `cURL` command and returns JSON of X and Y coordinates.
- `flask_api`
- Contains a program that accepts API calls for both a background sample and spectrum. This program accepts JSON through a `fetch()` or `cURL` command and returns JSON of X and Y coordinates.
- `functions.py`

- Contains functions used in all other files. Designed so edits only need to be made to one file for main functionality updates and changes.
- `spectrum.py`
- Contains a program that strictly generates a spectrum. This program uses `data.json` for its input and is capable of graphing using `mathplotlib`.

## [jupyter-notebook](https://github.com/RastonLab/Virtual-FTIR-Functions/tree/main/jupyter-notebook)
## scripts

- `download_hitran.py`

- This script downloads HITRAN data files locally. This is useful so the Flask application doesn't need to download data files during user queries.

- `virtual_environment.sh`

- This script creates a virtual python environments (venv) needed to run `app.py`. The script uses `requirements.txt` to install the required dependencies to a venv that is used for both directories. To activate the virtual environment (if your editor or terminal does not automatically activate it), run `source venv/bin/activate`. To deactivate the virtual environment, run `deactivate` in the terminal.
- NOTE: This script is designed to be run from outside the `scripts` directory.

---

This directory holds a Jupyter Notebook that was used in the testing and development of the spectrum modification functions. These functions emulate the blackbody spectrum (sPlanck), the beamsplitter, the cell windows, and the detector response spectrum.
### Flask Test Query

## [create-virtual-environments.sh](https://github.com/RastonLab/Virtual-FTIR-Functions/blob/main/create-virtual-environments.sh)
- `cURL`

This script creates a virtual python environments (venv) needed to run the files in the `api` and `jupyter-notebook` directories. The script uses `requirements.txt` to install the required dependencies to a venv that is used for both directories.
- This cURL command has be used in a terminal to test the applications ability to properly return the X and Y coordinates.

To activate the virtual environment (venv), run `source venv/bin/activate` in the terminal. To deactivate the virtual environment (venv), run `deactivate` in the terminal.
```
curl -X POST localhost:5000/spectrum \
-H "Content-type: application/json" \
-d "{ \
\"minWave\" : 1900, \
\"maxWave\" : 2300, \
\"molecule\" : \"CO\", \
\"pressure\" : 0.01, \
\"resolution\" : 1, \
\"numScan\" : 1, \
\"zeroFill\" : 0, \
\"source\" : 3100, \
\"beamsplitter\" : \"AR_ZnSe\", \
\"cellWindow\" : \"CaF2\", \
\"detector\" : \"MCT\" \
}"
```
97 changes: 0 additions & 97 deletions api/README.md

This file was deleted.

38 changes: 0 additions & 38 deletions api/background.py

This file was deleted.

13 changes: 0 additions & 13 deletions api/data.json

This file was deleted.

Loading