pysersic.galfit

Functions

search_start(→ list)

Search a list of strings and match those which start with to_match

load_fits_from_galfit_line(→ jax.numpy.array)

Load fits file from galfit config line

match_line_and_load_galfit(→ jax.numpy.array)

Combine the above two functions to search and load fits files from a galfit config

generate_fitter_from_galfit_config(...)

Function to generate a Fitter instance from a galfit config file. This function is only meant to be a starting place to easily try PySersic on the many galfit config files we know you all have lying around. As such this does not follow all of the rules and constraints the galfit takes into account. For more fine grained control we recommend initializing a pysersic Fitter instance yourself, please see the examples/ folder or the documentation for some help with this.

Module Contents

pysersic.galfit.search_start(list_of_strings: Iterable, to_match: str) list

Search a list of strings and match those which start with to_match

Parameters:
  • list_of_strings (Iterable)

  • to_match (str) – pattern to match

Returns:

List of results contianing the index and full string

Return type:

list

pysersic.galfit.load_fits_from_galfit_line(line: str) jax.numpy.array

Load fits file from galfit config line

Parameters:

line (str)

Returns:

Image in first HDU

Return type:

jnp.array

pysersic.galfit.match_line_and_load_galfit(list_of_strings: Iterable, to_match: str, assert_message: str = '') jax.numpy.array

Combine the above two functions to search and load fits files from a galfit config

Parameters:
  • list_of_strings (Iterable)

  • to_match (str)

  • assert_message (str, optional) – Message to raise if line file is not present

Returns:

_description_

Return type:

jnp.array

Raises:

UserWarning – _description_

pysersic.galfit.generate_fitter_from_galfit_config(config_loc: str, loss: callable = gaussian_loss) pysersic.FitSingle | pysersic.FitMulti

Function to generate a Fitter instance from a galfit config file. This function is only meant to be a starting place to easily try PySersic on the many galfit config files we know you all have lying around. As such this does not follow all of the rules and constraints the galfit takes into account. For more fine grained control we recommend initializing a pysersic Fitter instance yourself, please see the examples/ folder or the documentation for some help with this.

Parameters:
  • config_loc (str) – Config file locations

  • loss (callable, optional) – Loss function to use, see loss.py for more details, by default gaussian_loss

Returns:

Fitter based on config file. If there is only one source then returns a FitSingle object, otherwise returns a fit_multi

Return type:

Union[FitSingle,FitMulti]