Skip to content

Ddatabase for storing data acquired during the test campaign of the LSPE/Strip polarimeters

License

Notifications You must be signed in to change notification settings

lspestrip/stdb2

Folders and files

NameName
Last commit message
Last commit date
Dec 15, 2017
Jan 17, 2018
Dec 6, 2017
Nov 20, 2017
May 19, 2018
Nov 17, 2017
Oct 28, 2017
Aug 24, 2021
Oct 28, 2017
Jan 12, 2018
Nov 21, 2017
Nov 27, 2017
Oct 28, 2017
Sep 4, 2024

Repository files navigation

LSPE/Strip Test Database

License: MIT

This repository contains a Django project that runs a site to access a database of polarimetric unit tests for the LSPE/Strip instrument.

So far, the project is able to handle the test files acquired during the unit tests done in the cryogenic laboratory of the University of Milano Bicocca.

Installation

The program is written using Python3 and Django. The list of packages needed for the installation is listed in the file requirements.txt.

If you are using Anaconda Python (as you should), you can install most of the packages above using conda from the command line (e.g., conda install PACKAGE1 PACKAGE2...). A few of them are not available with conda: in this case use pip install.

Once you have a fully working Python environment, clone this repository:

git clone https://github.com/lspestrip/stdb2 && cd stdb2

Before running the application, you have to configure it. Copy the file example.env into a file named .env, and modify its settings according to your desire. In particular, you have to select a database backend in DATABASE_ENGINE. Possible alternatives are:

  • django.db.backends.sqlite3: SQLite3 (no configuration needed, thus very useful for debugging)
  • django.db.backends.postgresql: PostgreSQL (my personal top choice)
  • django.db.backends.mysql: MySQL
  • django.db.backends.oracle: Oracle Database

Another important option is MEDIA_ROOT, which points to the directory where uploaded tests will be saved. Be sure to pick a directory outside the Git repository of the code, otherwise you might inadvertently fill your repository with lots of data!

Important: you must manually create the following subdirectories within MEDIA_ROOT:

  1. unit_test_data (HDF5 files will be saved here);

  2. plots (PNG plots of time streams will be saved here);

  3. reports (any report attached to the results of an analysis will be saved here).

Once you have your fully tailored .env file, it's time to create the database. From the stdb2 directory run the following commands:

python manage.py makemigrations && python manage.py migrate

Now you must create an administrator account: this will be used to populate a few tables of the database which cannot be modified by normal users of the site:

python manage.py createsuperuser

You can now launch the site with the following command:

python manage.py runserver

It's time to fill a few database tables. Connect to http://127.0.0.1:8000/admin and log in using your administrator credentials. You must now enter some values in the tables Operators (list of the persons which have conducted the tests) and TestTye (types of tests for which data have been acquired).

Now it's time to run the site: disconnect from the admin page and go to http://127.0.0.1:8000/unittests. You can now start enjoying the site!

Running stdb2 with nginx and uWSGI

A good tutorial to show how to run Django-based applications (like stdb2) is available in the uWSGI documentation.

Logging

By default, stdb2 will write log messages into stdb2.log, within the base directory of the source code. You can customize the location of this file by setting the variable LOG_FILE_PATH in the configuration file .env.

REST API

Documentation for a JSON-based REST API is available here.

Utilities

The base directory contains a standalone program, convert_to_hdf5.py, which can be used to convert data files into HDF5 files from the command line. Run

convert_to_hdf5.py -h

to get the full help.

About

Ddatabase for storing data acquired during the test campaign of the LSPE/Strip polarimeters

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published