Settings#

Overview#

Using stellarphot starts with defining a bunch of configuration settings. Some of these, like details about your observing location and camera, will change infrequently. Others, like what size apertures to use for photometry and where in each image those apertures should be placed, may change from night to night.

All the settings can be made through a graphical interface, via the command line, or by editing an existing settings file.

The settings are grouped into these categories:

A copy of the settings are stored in a file called stellarphot_settings.json in the working directory where you are using stellarphot. It is these settings that are used when you run the photometry.

Settings can be generated using JupyterLab with a graphical interface, by using the command line, or by editing a settings file directly.

Settings groups#

Observatory information#

TBD

Camera information#

TBD

Provide a source list#

TBD

Some optional settings#

TBD

Entering settings programmatically#

Saved settings#

In addition to the settings file that is created in the working directory, you can save some settings on your system to make it easier to re-use the settings in the future. The settings that can be saved this way are the ones most likely to be reused: Camera, Observatory, and PassbandMap. The name property of each of these objects is used to identify the settings.

For example, if you have a camera that you use frequently, you can save the camera settings to a file and then load those settings in future sessions. If you are using the JupyterLab graphical interface, every new camera you create will be saved when you click the “Save” button. If you are working programmatically, you can save the camera settings to a file by using the add_item method of a SavedSettings object.

Suppose you have saved a camera named “My Fancy Camera”. To reuse that camera in a future session, you can select it in a dropdown in the JupyterLab graphical interface, or you can load it programmatically by using the get_item method of the SavedSettings class.

An example of creating such a camera, saving it, and then loading is below:

from stellarphot.settings import Camera, SavedSettings

# Create a camera
camera = Camera(
    name="My Fancy Camera",
    data_unit="adu",
    gain="1.0 electron/adu",
    read_noise="10.0 electron",
    dark_current="0.0 electron/s",
    pixel_scale="1.0 arcsec/pixel",
    max_data_value="50000 adu",
)

# Get access to the saved settings
saved_settings = SavedSettings()

# Save the camera
saved_settings.add_item(camera)

# Load the camera
new_camera = saved_settings.cameras.get("My Fancy Camera")

# Compare the two cameras to see if they are the same
print(camera == new_camera)

More about saved settings#

The SavedSettings class is a container for the saved settings. The location on disk depends on the operating system. You can find the location by running the following code:

from stellarphot.settings import SavedSettings

saved_settings = SavedSettings()
print(saved_settings.settings_path)

All settings can be deleted using the delete method of SavedSettings. You can delete all settings, or just the camera, observatory, or passband map settings. In each case you must pass in the argument confirm=True or an error will be raised. For example, to delete all settings:

from stellarphot.settings import SavedSettings

saved_settings = SavedSettings()
saved_settings.delete(confirm=True)

Deleting just the camera settings would be done like this:

from stellarphot.settings import SavedSettings

saved_settings = SavedSettings()
saved_settings.cameras.delete(confirm=True)

Finally, you can delete a single camera from the saved settings like this:

from stellarphot.settings import SavedSettings

saved_settings = SavedSettings()
saved_settings.cameras.delete(name="My Fancy Camera", confirm=True)

Reference/API#

stellarphot.settings Package#

Functions#

ui_generator(model)

Generate a user interface with ipyautoui with a few default settings.

Classes#

Camera(*arg, name, data_unit, gain, ...)

A class to represent a CCD-based camera.

Exoplanet(*arg[, epoch, period, depth, duration])

Create an object representing an Exoplanet.

LoggingSettings(*arg[, logfile, console_log])

Settings for logging.

Observatory(*arg, name, latitude, longitude, ...)

Class to represent an observatory.

PartialPhotometrySettings(*arg[, camera, ...])

Settings for performing aperture photometry.

PassbandMap(*arg, name, ...)

Class to represent a mapping from one set of filter names to another that behaves like a dict.

PhotometryApertures(*arg[, radius, gap, ...])

Settings for aperture photometry.

PhotometryFileSettings(*arg[, image_folder, ...])

An evolutionary step on the way to having a monolithic set of photometry settings.

PhotometryOptionalSettings(*arg[, ...])

Options for performing photometry.

PhotometrySettings(*arg, camera, ...)

Settings for performing aperture photometry.

PhotometryWorkingDirSettings([...])

Class to save in-progress and complete photometry settings in the working directory.

SavedSettings([_testing_path, _create_path])

Handle loading and saving of settings files from disk.

SourceLocationSettings(*arg, source_list_file)

Settings for the location of the source list and the image files.

Class Inheritance Diagram#

Inheritance diagram of stellarphot.settings.models.Camera, stellarphot.settings.models.Exoplanet, stellarphot.settings.models.LoggingSettings, stellarphot.settings.models.Observatory, stellarphot.settings.models.PartialPhotometrySettings, stellarphot.settings.models.PassbandMap, stellarphot.settings.models.PhotometryApertures, stellarphot.settings.models.PhotometryFileSettings, stellarphot.settings.models.PhotometryOptionalSettings, stellarphot.settings.models.PhotometrySettings, stellarphot.settings.settings_files.PhotometryWorkingDirSettings, stellarphot.settings.settings_files.SavedSettings, stellarphot.settings.models.SourceLocationSettings