Skip to content
This repository has been archived by the owner on Aug 25, 2023. It is now read-only.
/ CloudyInterpolator Public archive

Web interface for astroplasma repository by @dutta-alankar

License

Notifications You must be signed in to change notification settings

tbhaxor/CloudyInterpolator

Repository files navigation

Web Interface of AstroPlasma


This is a web interface for the AstroPlasma repository which allows you to interpolate the plasma properties from the pre-computed dataset from the cloudy.

Features

  • Compute Ionization Fraction of the Specific Element and Ion
  • Plot Ion fraction vs temperature graph for both CIE and PIE modes
  • Plot emission spectrum of the elements
  • Interactive graphs
  • Simple file server to download the batch file on demand (used internally in upstream AstroPlasma repository)

Requirements

  1. Docker engine
  2. Poetry
  3. Python 3.9+
  4. Git CLI
  5. Dataset mounted using nfs (Contact me or @dutta-alankar)

Setup

  1. Clone the repository

    git clone https://github.com/tbhaxor/CloudyInterpolator.git
    cd CloudyInterpolator
  2. Install the packages

    poetry install

    Note This command will automatically set-up virtual environment for you.

  3. Provide environment file

    cat <<EOF > .env
    IONIZATION_DATASET_DIR='/path/to/directory/containing/ionization-batches'
    EMISSION_DATASET_DIR='/path/to/directory/containing/emission-batches'
    PY_ENV=dev
    EOF

    Note Omit PY_ENV=dev if you want to deploy it on the production

  4. Migrate the database

    poetry run python manage.py migrate

Getting started

Once you have performed the steps from the Setup, you are good to go

poetry run python manage.py runserver

This will open the 8000 port by default, but you can change it using the following command

poetry run python manage.py runserver 127.0.0.1:<PORT>

Replace the placeholder <PORT> with the port number of your choice.

Using Docker Containers

Get rid of all the hassle of setup and getting started. You can use the following

Requirements Docker runtime and docker compose installed on your system

  1. Generate docker compose file from the template file

    bash deployment/scripts/gen-docker-compose.bash -c http://example.com -i /path/to/ionization/dataset -e /path/to/emission/dataset

    Note Let's suppose I am hosting my webserver on the http://example.com, so it should be the value of -c argument. You can provide multiple origins separated by comma and without any spaces.

  2. Run the workload

    docker-compose up --pull always

    Note You can access the server at port http://localhost:8000.

Using local configuration [[RECOMMENDED]]

The configuration template named as docker-compose.local.yml is now a recommended version as code is not frequently built.

  1. Generate docker compose file from the template file
bash deployment/scripts/gen-docker-compose.bash -s docker-compose.local.yml -c http://example.com -i /path/to/ionization/dataset -e /path/to/emission/dataset
  1. Install the dependencies

    poetry install
  2. Generate static files

    poetry run ./manage.py collectstatic --noinput  --skip-checks
  3. Run the server

    docker-compose up --pull always

    Note You can access the server at port http://localhost:8000.