Skip to content

code_structure

Dominic Ford edited this page Feb 20, 2019 · 6 revisions

4GP Code Structure

4GP is organised into a collection of python modules, most of which do not depend on each other. These can be found in the directory src/pythonModules.

The code is divided up in this way since each module has different dependencies, and it allows various parts of 4GP to be used without installing every dependency.

Before you start, you will need to install these python modules into your python environment.

It is recommended that they be installed in a python virtual environment as described in the installation instructions, and that you do not install them into your system-wide python installation. Alternatively, you can use a python distribution such as Conda to create your own python environment.

The python modules that make up 4GP are as follows:

fourgp_speclib - Core classes representing spectra and libraries to keep them in. These include functionality to search for spectra within libraries based on arbitrary metadata constraints. Behind the scenes, this metadata is stored in a SQL database, and both SQLite (recommended) and MySQL are supported. All other 4GP modules depend on this core module.

fourgp_specsynth - A wrapper for synthesising spectra with given stellar parameters using Turbospectrum.

fourgp_fourfs - A wrapper for create mock 4MOST observations of spectra using 4FS; specifically, using the 4MOST Exposure Time Calculator (ETC). This reduces the resolution of the input spectra to match 4MOST's instrumental profile, and also adds noise to the spectra.

fourgp_cannon - A wrapper for the Cannon, a machine learning framework for deriving stellar parameters and abundances from spectra.

fourgp_payne - A wrapper for the Payne, a machine learning framework for deriving stellar parameters and abundances from spectra.

fourgp_degrade - Some simple functions for convolving spectra with custom instrumental profiles, for resampling them onto new wavelength rasters, and for adding simple noise to spectra.

fourgp_telescope_data - A container for basic instrumental data about 4MOST, including its wavelength coverage and spectral resolution.

fourgp_rv - A module which implements a simple cross-correlation algorithm for determining the radial velocities of stars (based loosely on the GUESS code used by GALAH).

fourgp_pipeline - A module which implements a simple pipeline for analysing FGK stars. The example pipeline uses the fourgp_rv module to determine each star's RV, before using the Cannon to do abundance analysis. The pipeline is designed to be easily extensible, so that additional tasks can be added to the work flow, or existing tasks replaced with others.

Clone this wiki locally