astrophot package

Subpackages

Submodules

astrophot.AP_config module

astrophot.AP_config.set_logging_output(stdout=True, filename=None, **kwargs)[source]

Change the logging system for AstroPhot. Here you can set whether output prints to screen or to a logging file. This function will remove all handlers from the current logger in ap_logger, then add new handlers based on the input to the function.

Parameters:
  • stdout (bool) – If True, log messages will be printed to the console (standard output). Default is True.

  • filename (str) – If given as a string, this will be the name of the file that log messages are written to. If None, no logging file will be used. Default is None.

  • stdout_level (logging.INFO) – The logging level of messages written to stdout, this can be different from the file level. Default is logging.INFO.

  • stdout_formatter (logging.Formatter) – A logging.Formatter object which determines what information to include with the logging message only when printing to stdout. Default is logging.Formatter(‘%(message)s’).

  • filename_level (int) – The logging level of messages written to the log file, this can be different from the stdout level. Default is logging.INFO.

  • filename_formatter (logging.Formatter) – A logging.Formatter object which determines what information to include with the logging message only when printing to the log file. Default is logging.Formatter(‘%(asctime)s:%(levelname)s: %(message)s’).

Module contents

astrophot.run_from_terminal() None[source]

Execute AstroPhot from the command line with various options.

This function uses the argparse module to parse command line arguments and execute the appropriate functionality. It accepts the following arguments:

  • filename: the path to the configuration file. Or just ‘tutorial’ to download tutorials.

  • –config: the type of configuration file being provided. One of: astrophot, galfit.

  • -v, –version: print the current AstroPhot version to screen.

  • –log: set the log file name for AstroPhot. Use ‘none’ to suppress the log file.

  • -q: quiet flag to stop command line output, only print to log file.

  • –dtype: set the float point precision. Must be one of: float64, float32.

  • –device: set the device for AstroPhot to use for computations. Must be one of: cpu, gpu.

If the filename argument is not provided, it raises a RuntimeError. If the filename argument is tutorial or tutorials, it downloads tutorials from various URLs and saves them locally.

This function logs messages using the AP_config module, which sets the logging output based on the –log and -q arguments. The dtype and device of AstroPhot can also be set using the –dtype and –device arguments, respectively.

Returns:

None