oimModel

Creation of models

Classes:

oimModel(*components)

The oimModel class hold a model made of one or more components (derived from the oimComponent class).

class oimodeler.oimModel.oimModel(*components: List[oimComponent])

The oimModel class hold a model made of one or more components (derived from the oimComponent class).

It allows to compute images (or image cubes for wavelength or time dependent models) and complex coherent fluxes for a vector of u,v,wl, and t coordinates.

Parameters:

*components (list of oimComponent) – The components of the model.

Variables:

components (list of oimComponent) – The components of the model.

getComplexCoherentFlux(ucoord: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], vcoord: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], wl: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, t: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None) ndarray

Compute and return the complex coherent flux for an array of u,v (and optionally wavelength and time) coordinates.

Parameters:
  • ucoord (array_like) – Spatial coordinate u (in cycles/rad).

  • vcoord (array_like) – Spatial coordinate vu (in cycles/rad).

  • wl (array_like, optional) – Wavelength(s) in meter. The default is None.

  • t (array_like, optional) – Time in s (mjd). The default is None.

Returns:

The complex coherent flux. The same size as u & v

Return type:

numpy.ndarray

getParameters(free: bool | None = False) Dict[str, oimParam]

Get the Model paramters (or free parameters)

Parameters:

free (bool, optional) – If True retrieve the free parameters of the models only. The default is False.

Returns:

params – Dictionary of the model’s parameters (or free parameters).

Return type:

Dict of oimParam

getFreeParameters() Dict[str, oimParam]

Get the Model free paramters

Returns:

A Dictionary of the model’s free parameters.

Return type:

Dict of oimParam

getImage(dim: int, pixSize: float, wl: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, t: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, toFits: bool | None = False, fromFT: bool | None = False, squeeze: bool | None = True, normalize: bool | None = False) ndarray | PrimaryHDU

Compute and return an image or and image cube (if wavelength and time are given).

The returned image as the x,y dimension dim in pixel with an angular pixel size pixSize in rad. Image is returned as a numpy array unless the keyword fits is set to True. In that case the image is returned as an astropy.io.fits hdu.

Parameters:
  • dim (int) – Image x & y dimension in pixels.

  • pixSize (float) – Pixel angular size in mas.

  • wl (int or array_like, optional) – Wavelength(s) in meter. The default is None.

  • t (int or array_like, optional) – Time in s (mjd). The default is None.

  • toFits (bool, optional) – If True returns result as a fits hdu. The default is False.

  • fromFT (bool, optional) – If True compute the image using FT formula when available. The default is False.

  • squeeze (bool, optional) – If False returns a (nt,nwl,dim,dim) array even if nt and/or nwl equal 1. The default is True.

  • normalize (bool, optional) – If True normalizes the image.

Returns:

A numpy 2D array (or 3D/4D array if wl, t or both are given) or an astropy.io.fits hdu.imagehdu if fits=True. The image of the component with given size in pixels and mas or rad

Return type:

numpy.ndarray or astropy.io.fits.hdu

saveImage(filename: str, dim: int, pixSize: float, wl: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, t: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, fromFT: bool | None = False, normalize: bool | None = False) ndarray | PrimaryHDU

Save the model image

Parameters:
  • filename (str) – The name the file is to be saved as.

  • dim (int) – Image x & y dimension in pixels.

  • pixSize (float) – Pixel angular size in mas.

  • wl (int or array_like, optional) – Wavelength(s) in meter. The default is None.

  • t (int or array_like, optional) – Time in s (mjd). The default is None.

  • fromFT (bool, optional) – If True compute the image using FT formula when available. The default is False.

  • normalize (bool, optional) – If True normalizes the image.

Returns:

A numpy 2D array (or 3D/4D array if wl, t or both are given). The image of the component with given size in pixels and mas or rad

Return type:

numpy.ndarray or astropy.io.fits.hdu

showModel(dim: int, pixSize: float, wl: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, t: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, fromFT: bool | None = False, axe: Axes | None = None, normPow: float | None = 0.5, figsize: Tuple[float] | None = (3.5, 2.5), savefig: str | None = None, colorbar: bool | None = True, legend: bool | None = False, swapAxes: bool | None = True, kwargs_legend: Dict = {}, normalize: bool | None = False, rebin: bool | None = False, **kwargs: Dict) Tuple[Figure, Axes, ndarray]

Show the mode Image or image-Cube

Parameters:
  • dim (int) – Image x & y dimension in pixels.

  • pixSize (float) – Pixel angular size in mas.

  • wl (int or array_like, optional) – Wavelength(s) in meter. The default is None.

  • t (int or array_like, optional) – Time in s (mjd). The default is None.

  • fromFT (bool, optional) – If True compute the image using FT formula when available. The default is False.

  • axe (matplotlib.axes.Axes, optional) – If provided the image will be shown in this axe. If not a new figure will be created. The default is None.

  • normPow (float, optional) – Exponent for the Image colorscale powerLaw normalisation. The default is 0.5.

  • figsize (tuple of float, optional) – The Figure size in inches. The default is (8., 6.).

  • savefig (str, optional) – Name of the files for saving the figure If None the figure is not saved. The default is None.

  • colorbar (bool, optional) – Add a colobar to the Axe. The default is True.

  • legend (bool, optional) – If True displays a legend. Default is False.

  • swapAxes (bool, optional) – If True swaps the axes of the wavelength and time. Default is True.

  • kwargs_legend (dict, optional)

  • normalize (bool, optional) – If True normalizes the image.

  • rebin (bool, optional) – If True rebin the image according to oimOptions[“FTBinningFactor”].

  • **kwargs (dict) – Arguments to be passed to the plt.imshow function.

Returns:

  • fig (matplotlib.figure.Figure) – The Figure created if needed.

  • axe (matplotlib.axes.Axes) – The Axes instances, created if needed.

  • im (numpy.array) – The image(s).

showFourier(dim: int, pixSize: float, wl: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, t: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None, axe: Axes | None = None, normPow: float | None = 0.5, figsize: Tuple[float] | None = (3.5, 2.5), savefig: str | None = None, colorbar: bool | None = True, legend: bool | None = False, swapAxes: bool | None = True, display_mode: str | None = 'vis', kwargs_legend: Dict | None = {}, normalize: bool | None = False, **kwargs: Dict)

Show the amplitude and phase of the Fourier space

Parameters:
  • dim (int) – Image x & y dimension in pixels.

  • pixSize (float) – Pixel angular size in mas.

  • wl (int or array_like, optional) – Wavelength(s) in meter. The default is None.

  • t (int or array_like, optional) – Time in s (mjd). The default is None.

  • axe (matplotlib.axes.Axes, optional) – If provided the image will be shown in this axe. If not a new figure will be created. The default is None.

  • normPow (float, optional) – Exponent for the Image colorscale powerLaw normalisation. The default is 0.5.

  • figsize (tuple of float, optional) – The Figure size in inches. The default is (8., 6.).

  • savefig (str, optional) – Name of the files for saving the figure If None the figure is not saved. The default is None.

  • colorbar (bool, optional) – Add a colobar to the Axe. The default is True.

  • legend (bool, optional) – If True displays a legend. Default is False.

  • swapAxes (bool, optional) – If True swaps the axes of the wavelength and time. Default is True.

  • display_mode (str, optional) – Displays either the amplitude “amp” or the phase “phase”. Default is “amp”.

  • kwargs_legend (dict, optional)

  • normalize (bool, optional) – If True normalizes the image.

  • **kwargs (dict) – Arguments to be passed to the plt.imshow function.

Returns:

  • fig (matplotlib.figure.Figure) – The Figure created if needed

  • axe (matplotlib.axes.Axes) – The Axes instances, created if needed.

  • im (numpy.ndarray) – The image(s).