Skip to main content

Mimical (Modelling the Intensity of Multiply-Imaged CelestiAl Light)

Mimical is an intensity modelling code optimised for multiply-imaged objects (image cubes), performing simultaneous Bayseian inference of model parameters via the nested sampling algorithm. Mimical currently supports Sersic and Point-source submodels, but users can easily bolt-on any other 2D submodel. Since every new filter introduces new submodel free parameters, Mimical supports the assumption of a user defined polynomial or power-law dependency with image wavelength, automatically sampling their coefficients over the allowed parameter region. Additionally, with support for CPU parallelisation via MPI and GPU acceleration via PyTorch, Mimical has significant computational flexibility, allowing users to tune their settings based on available hardware.

Installation

Mimical can be installed with pip:

pip install mimical
docs/fit_example.png

Required input

  1. images - A list of images with slices for each filter.

  2. filt_list - A list of path strings to the filter transmission curve files.

  3. psfs - A list of PSF images with slices for each filter. (Normalised to 1)

  4. mimical_prior - The Mimical prior (see below)

Mimical prior

Below is an example mimical_prior for a run using the default Sersic submodel. The first set of element keys must have 'source' and themselves contain keys that match the submodel parameter names. Users can include any number of these to fit multiple-component models. Following this, the next element, named psf_pa, traces the rotation of the PSF. The final two elements must be named rms and counts_per_flux.

source_1 = {}
source_1['model'] = mimical.Sersic()
source_1['mag'] = ((0, 1), 'Individual')
source_1['r_eff'] = ((0, 50), 'Polynomial', 1)
source_1['n'] = ((0.1, 10), 'Polynomial', 1)
source_1['x_0'] = ((48, 52), 'Polynomial', 0)
source_1['y_0'] = ((48, 52), 'Polynomial', 0)
source_1['ellip'] = ((0,0.75), 'Polynomial', 0)
source_1['theta'] = ((0, np.pi), 'Polynomial', 0)

mimical_prior = {}
mimical_prior['source_1'] = source_1
mimical_prior['psf_pa'] = ((-180, 180), 'Polynomial', 0)
mimical_prior['rms'] = ('Infer', 'Individual')
mimical_prior['counts_per_flux'] = (cpf_list, 'Individual')

The rms parameter traces the RMS noise in the image; this can be fit with Mimical but it is highly recommended to fix it in order to reduce dimensionality (see Fixing parameters), either by passing it in as a float / array / list of floats / list of arrays of the same length and shape as images, or by selecting the special Mimical prior type 'Infer' which automatically calculates the RMS of the image background as identified by SourceExtractor.

Similarly for counts_per_flux, which allows Mimical to associate poisson uncertainty with the generated model, it is recommended to fix it to a provided quantity (float / array / list of floats / list of arrays of the same length and shape as images). This may be challenging to derive, but can be provided by the user with information on the gain, exposure time, etc. To neglect poisson uncertainty, this should be set to a high number (but not too high to effect numerical overflow) e.g. 1e50.

Optional input and parameters

  • se_clean : Whether or not to let SourceExtractor clean the input images of contaminants. Must allow ‘sex’ command via terminal.

  • se_maxdist : The distance after which the closest detected source is considered a contaminant. Necessary for images in which the target is undetected.

  • dilute : Whether or not to apply a circular miminum filter over the contamination map to dilute it.

  • dilute_radius : If dilute is True, apply minimim filter with radius dilute_radius over the contamination map.

Fixing parameters

You can fix any of the parameters in the Mimical prior by setting the first element in the parameter tuple equal to either a float / int / list. For instance, to keep x_0 constant across all images, one would pass a float/int and choose the options (float/int, 'Polynomial', 0). Or, to supply the RMS for each image separately, one would pass a 1d array or 3D image cube of length Nfilters and choose the options (array, 'Individual'). If the user supplies an image cube for RMS and/or counts-per-flux, these must be the same shape as the images, and while the corner plot samples will show the mean of these images for generality, the full arrays will be parsed in the likelihood function.

Parallelisation

Mimical can be parallelised to different cores in one of two ways:

  • The likelihood calculations can be parallelised to different cores by using the pool keyword argument in the run function. This is ideal for single object fits.

  • When using fit_catalogue, the mpi_serial keyword arguement can be set to True for individual object fits to be parallelised to separate cores. With this option enabled, mimical must be run using mpirun/mpiexec -n [ncores] python [filename].py. This is ideal for large catalogue fits.

Running Mimical with both of these options enabled is untested but probably infeasible.

GPU acceleration

The most computationally expensive step in Mimical is the model generation, which takes place in each likelihood call when a new set of model parameters is sampled. This step has been vectorised and written with PyTorch tensors, such that if a compatible GPU is available (such as an Nvidia card or apple silicon M-series chip) the model generation can be accelerated.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mimical-0.6.7-py2.py3-none-any.whl (156.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file mimical-0.6.7-py2.py3-none-any.whl.

File metadata

  • Download URL: mimical-0.6.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 156.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for mimical-0.6.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0397e513b7a5a0ba144f08d55a37c1b0858abb596af4d2faf2ea63d5a5678f0d
MD5 49d01bad0e434cb6afbfdd7e9d40a59b
BLAKE2b-256 c3b878955297b928cb61a7406cc11f2d0d0e7517c4f7a1f0caa1a91f51694ad4

See more details on using hashes here.

Release history Release notifications | RSS feed

0.7.1

1 file

0.7.0

1 file

0.6.9

1 file

0.6.8

1 file

This release

0.6.7 This release

1 file

0.6.6

1 file

0.6.5

1 file

0.6.4

1 file

0.6.3

1 file

0.6.2

1 file

0.6.1

1 file

0.6.0

1 file

0.5.9

1 file

0.5.8

1 file

0.5.7

1 file

0.5.6

1 file

0.5.5

1 file

0.5.4

1 file

0.5.3

1 file

0.5.2

1 file

0.5.1

1 file

0.5.0

1 file

0.4.9

1 file

0.4.8

1 file

0.4.7

1 file

0.4.6

1 file

0.4.5

1 file

0.4.4

1 file

0.4.3

1 file

0.4.2

1 file

0.4.1

1 file

0.4.0

1 file

0.3.9

1 file

0.3.8

1 file

0.3.7

1 file

0.3.6

1 file

0.3.5

1 file

0.3.4

1 file

0.3.3

1 file

0.3.2

1 file

0.3.1

1 file

0.3.0

1 file

0.2.9

1 file

0.2.8

1 file

0.2.7

1 file

0.2.6

1 file

0.2.5

1 file

0.2.4

1 file

0.2.3

1 file

0.2.2

2 files

0.2.1

1 file

0.2.0

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page