Example extension Module

An example Sculptor Extension

This module defines models, masks and analysis routines as an example to create your own Sculptor extension.

At first we define the basic model functions and their setups. The setup functions initialize LMFIT models and parameters using the basic model functions defined here.

When youy define a mask you need to specify the name under which it will appear in the Sculptor GUI, the rest_frame keyword and the mask ranges to that will be included in the SpecModel masking or excluded in the SpecFit masking. With rest_frame=True the mask regions will automatically be adjusted for the object redshift specified in the SpecFit class. With rest-frame=False the mask will not be redshifted.

sculptor_extensions.my_extension.model_func_dict = {'my_model': <function my_model>}

List of model names


list of str

sculptor_extensions.my_extension.model_func_list = ['My Model']

Dictionary of model setup function names



sculptor_extensions.my_extension.model_setup_list = [<function setup_my_model>]

Dictionary of mask presets



sculptor_extensions.my_extension.my_mask = {'mask_ranges': [[1265, 1290], [1340, 1375], [1425, 1470], [1680, 1705], [1905, 2050]], 'name': 'My mask', 'rest_frame': True}

Dictionary of model functions



sculptor_extensions.my_extension.my_model(x, z, amp, cen, fwhm_km_s, shift_km_s)

Gaussian line model as an example for a model

The central wavelength of the Gaussian line model is determined by the central wavelength cen, the redshift, z, and the velocity shift shift_km_s (in km/s). These parameters are degenerate in a line fit and it is adviseable to fix two of them (to predetermined values e.g., the redshift or the central wavelength).

The width of the line is set by the FWHM in km/s.

The Gaussian is not normalized.

  • x (np.ndarray) – Dispersion of the continuum model

  • z (float) – Redshift

  • amp (float) – Amplitude of the Gaussian

  • cen (float) – Central wavelength

  • fwhm_km_s (float) – FWHM of the Gaussian in km/s

  • shift_km_s (float) – Doppler velocity shift of the central wavelength


Gaussian line model

Return type:


sculptor_extensions.my_extension.setup_my_model(prefix, **kwargs)

Example of a model setup function for the Gaussian emission line model.

The ‘prefix’ argument needs to be included. You can use a variety of keyword arguments as you can see below.

  • prefix (string) – Model prefix

  • kwargs – Keyword arguments


LMFIT model and parameters

Return type:

(lmfit.Model, lmfit.Parameters)