API

Contents

Supernovae Functions

Public Objects

Supernovae.mainMethod
main(toml_path::AbstractString, verbose::Bool, profile::Bool)

Loads toml_path, and sets up logging with verbosity based on verbose. Runs run_Supernovae and if profile is true, also profiles the code.

Arguments

  • toml_path::AbstractString: Path to toml input file.
  • verbose::Bool: Set verbosity of logging
  • profile::Bool: If true, profile run_Supernovae

Private Objects

RunModule Functions

Public Objects

Supernovae.RunModule.run_SupernovaeMethod
run_Supernovae(toml::Dict{String, Any})

Main entrance function for the package

Arguments

  • toml::Dict{String, Any}: Input toml file containing all options for the package

Private Objects

FilterModule Functions

Public Objects

Supernovae.RunModule.FilterModule.FilterType
struct Filter

Photometric filter transmission curve.

Fields

  • facility::String: Name of the filter's facility (NewHorizons, Keper, Tess, etc...)
  • instrument::String: Name of the filter's instrument (Bessell, CTIO, Landolt, etc...)
  • passband::String: Name of the filter's passband (g, r, i, z, etc...)
  • wavelength::Vector{Å}: Transmission curve wavelength
  • transmission::Vector{Float64}: Transmission curve transmission
Supernovae.RunModule.FilterModule.FilterMethod
Filter(facility::String, instrument::String, passband::String, filter_file::AbstractString)

Make Filter object from filter_file transmission curve.

Arguments

  • facility::String: Name of the filter's facility
  • instrument::String: Name of the filter's instrument
  • passband::String: Name of the filter's passband
  • filter_file::AbstractString: Path to transmission curve file. Assumed to be a comma delimited wavelength,transmission file.
Supernovae.RunModule.FilterModule.FilterMethod
Filter(facility::String, instrument::String, passband::String, config::Dict{String, Any})

Make Filter object from config options. config must include "FILTERPATH" => path/to/transmissioncurve. If this file exists, the transmission curve will be loaded via Filter(facility::String, instrument::String, passband::String, filter_file::AbstractString), otherwise attempt to create Filter via Filter(facility::String, instrument::String, passband::String, svo::PyCall.PyObject) and the SVO FPS database.

Arguments

  • facility::String: Name of the filter's facility
  • instrument::String: Name of the filter's instrument
  • passband::String: Name of the filter's passband
  • config::Dict{String, Any}: Options for creating a Filter.
Supernovae.RunModule.FilterModule.FilterMethod
Filter(facility::String, instrument::String, passband::String, svo::PyCall.PyObject)

Make Filter object from svo transmission curve.

Arguments

  • facility::String: Name of the filter's facility
  • instrument::String: Name of the filter's instrument
  • passband::String: Name of the filter's passband
  • svo::Pycall.PyObject: SVO transmission curve
Supernovae.RunModule.FilterModule.planckMethod
planck(T::Unitful.Unitful.Temperature, λ::Unitful.Length)

Planck's law: Calculates the specral radiance of a blackbody at temperature T, emitting at wavelength λ

Arguments

  • T::Unitful.Temperature: Temperature of blackbody
  • λ::Unitful.Length: Wavelength of blackbody
Supernovae.RunModule.FilterModule.synthetic_fluxMethod
synthetic_flux(filter::Filter, T::Unitful.Temperature)

Calculates the flux of a blackbody at temperature T, as observed with the filter

Arguments

  • filter::Filter: The Filter through which the blackbody is observed
  • T::Unitful.Temperature: The temperature of the blackbody

Private Objects

Supernovae.RunModule.FilterModule.svoMethod
svo(facility::String, instrument::String, passband::String)

Attempt to get filter transmission curve from SVO. Uses the python package astroquery via PyCall.

Arguments

  • facility::String: SVO name for the filter's facility
  • instrument::String: SVO name for the filter's instrument
  • passband::String: SVO name for the filter's passband

PhotometryModule Functions

Public Objects

Supernovae.RunModule.PhotometryModule.LightcurveMethod
Lightcurve(observations::Vector{Dict{String,Any}}, zeropoint::Magnitude, redshift::Float64, config::Dict{String,Any}; max_flux_err::Flux=Inf * 1.0u"μJy", peak_time::Union{Bool,Float64}=false)

Create a Lightcurve from a Vector of observations, modelled as a Vector of Dicts. Each observation must contains the keys NAME, and PATH which specify the name of the supernovae, and a path to the photometry respectively. PATH can either be absolute, or relative to DATA_PATH as specified in [ GLOBAL ] and is expected to be a delimited file of rows and columns, with a header row describing the content of each column, and a row for each individual photometric observation of the lightcurve. Each observation in PATH must contain a time, flux, and flux error column. You can also optionally pescribe a seperate facility, instrument, passband, and upperlimit column. If any of these column exist, they will be read per row. If not, you must specify a global value. The keys DELIMITER::String=", ", and COMMENT::String="#" allow you to specify the delimiter and comment characters used by PATH.

The rest of the keys in an observation are for reading or overwriting the photometry in PATH. You can overwrite the facility (FACILITY::String), instrument (INSTRUMENT::String), passband (PASSBAND::String), and whether the photometry is an upperlimit (UPPERLIMIT::Union{Bool, String}). Specifying any overwrites will apply that overwrite to every row of PATH. You can also specify a flux offset (FLUX_OFFSET) assumed to be of the same unit as the flux measurements in PATH. By default, the upplimit column / overwrite is assumed to be a string: upperlimit∈["T", "TRUE", "F", "FALSE"], if you instead want a different string identifier, you can specify UPPERLIMIT_TRUE::Union{String, Vector{String}}, and UPPERLIMIT_FALSE::Union{String, Vector{String}}.

Each column of PATH, including the required time (TIME), flux (FLUX), and flux error (FLUX_ERR), and the optional facility (FACILITY), instrument (INSTRUMENT), passband (PASSBAND), and upperlimit (UPPERLIMIT) columns, can have both an identifier of the column, and the unit of the values be specified (units must be recognisable by Unitful. There are three ways to do this. All of these methods are described by specifying identifiers through HEADER.OBJECT_NAME.COL and either HEADER.OBJECT_NAME.UNIT or HEADER.OBJECT_NAME.UNIT_COL. For example to given an identifier for time, you'd include HEADER.TIME.COL and HEADER.TIME.UNIT.

The first method is to simply assume the headers have the syntax name [unit], with time, flux, and flux error having the names time, flux, and flux_err respectively. This is the default when no identifiers are given, but can also be used for the unit identifier by specifying HEADER.OBJECT_NAME.UNIT = "DEFAULT".

The next method involves specifying the name of the column containing data of the object in question. This is simply HEADER.OBJECT_NAME.COL = "col_name". For the unit you can either specify a global unit for the object via HEADER.OBJECT_NAME.UNIT = "unit", or you can specify a unit column by name via HEADER.OBJECT_NAME.UNIT_COL = "unit_col_name".

The final method is to specify the index of the column containing data of the object in questions. This is done via HEADER.OBJECT_NAME.COL = col_index. Once again you can either specify a global unit or the index of the column containing unit information via HEADER.OBJECT_NAME.UNIT_COL = unit_col_index. Your choice of identifer can be different for each object and unit, for instance you could specify the name of the time column, and the index of the time unit column.

As for the rest of the inputs, it is required to specify a zeropoint (in some magnitude unit), the redshift, and provide a global config. You can specify a maximum error on the flux via max_flux_err, which will treat every observation with a flux error greater than this as an outlier which will not be included. Finally you can specify a peak time which all other time parameters will be relative to (i.e, the peak time will be 0 and all other times become time - peaktime). This can either be true, in which case the peak time will be set to the time of maximum flux, or a float with units equal to the units of the time column. If you don't want relative times, set `peaktimetofalse`, which is the default.

Arguments

  • observations::Vector{Dict{String,Any}}: A Vector of Dicts containing information and overwrites for the file containing photometry of the supernova.
  • zeropoint::Magnitude: The zeropoint of the supernova
  • redshift::Float64: The redshift of the supernova
  • config::Dict{String,Any}: The global config, containing information about paths
  • max_flux_err::Flux=Inf * 1.0u"μJy": An optional constrain on the maximum flux error. Any observation with flux error greater than this is considered an outlier and removed from the lightcurve.
  • peak_time::Union{Bool, Float64}=false: If not false, times will be relative to peak_time (i.e, will transform from time to time - peak_time). If true times a relative to the time of peak flux, otherwise times are relative to peak_time, which is assumed to be of the same unit as the times.
Supernovae.RunModule.PhotometryModule.ObservationType
mutable struct Observation

A single observation of a supernova, including time, flux, magnitude and filter information.

Fields

  • name::String: The name of the supernova
  • time::typeof(1.0u"d"): The time of the observation in MJD
  • flux::typeof(1.0u"Jy"): The flux of the observation in Jansky
  • flux_err::typeof(1.0u"Jy"): The flux error of the observation in Jansky
  • mag::typeof(1.0u"AB_mag"): The magnitude of the observations in AB Magnitude
  • mag_err::typeof(1.0u"AB_mag"): The magnitude error of the observations in AB Magnitude
  • absmag::typeof(1.0u"AB_mag"): The absolute magnitude of the observations in AB Magnitude
  • absmag_err::typeof(1.0u"AB_mag"): The absolute magnitude error of the observations in AB Magnitude
  • filter::Filter: The Filter used to observe the supernova
  • is_upperlimit::Bool: Whether the observation is an upperlimit
Supernovae.RunModule.PhotometryModule.flux_to_magMethod
flux_to_mag(flux::Unitful.Quantity{Float64}, zeropoint::Level)

Convert flux to magnitudes. Calculates zeropoint - 2.5log10(flux). Returns AB_mag units

Arguments

  • flux::Unitful.Quantity{Float64}: The flux to convert, in units compatible with Jansky. If the flux is negative it will be set to 0.0 to avoid log10 errors
  • zeropoint::Level: The assumed zeropoint, used to convert the flux to magnitudes.
Supernovae.RunModule.PhotometryModule.mag_to_absmagMethod
mag_to_absmag(mag::Level, redshift::Float64; H0::Unitful.Quantity{Float64}=70.0u"km/s/Mpc")

Converts mag to absolute magnitude. Calculates mag - 5 log10(c * redshift / (H0 * 10pc))

Arguments

  • mag::Level: The magnitude to convert
  • redshift::Float64: The redshift, used to calculate the distance to the object
  • ;H0::Unitful.Quantity{Float64}=70.0u"km/s/Mpc: The assumed value of H0, used to calculate the distance to the object

Private Objects

Supernovae.RunModule.PhotometryModule.flux_err_to_mag_errMethod
flux_err_to_mag_err(flux::Unitful.Quantity{Float64}, flux_err::Unitful.Quantity{Float64})

Converts flux_err to magnitude error. Calculates (2.5 / log(10)) * (flux_err / flux).

Arguments

  • flux::Unitful.Quantity{Float64}: The flux associated with the error to be converted
  • flux_err::Unitful.Quantity{Float64}: The flux error to be converted
Supernovae.RunModule.PhotometryModule.get_column_idMethod
get_column_id(header::Vector{String}, column_id::String)

Find the column in header which contains the given column_id and return its index.

Arguments

  • header::Vector{String}: The header, split by column
  • column_id::String: The column title to search for in header
Supernovae.RunModule.PhotometryModule.get_column_indexMethod
get_column_index(header::Vector{String}, header_keys::Dict{String,Any})

Determine the index of each column withing header associated with header_keys

Arguments

  • header::Vector{String}: The header, split by column names
  • header_keys::Dict{String, Any}: Determine the index of these parameters. The key::String is the type of object stored in the column, for instance "TIME", "FLUX", "MAG_ERR", and so on. The values::Any can be an Int64 or a String where the former indicates the column index (which is simply returned) and the latter represents the name of the key object inside header. For instance key = "FLUX" might map to a column in the header title "Flux", "F", "emmission", or "uJy".
Supernovae.RunModule.PhotometryModule.get_default_unitMethod

getdefaultunit(header::Vector{String}, columnid::String, columnindex::Int64)

If no unit is provided for a parameter, it is assumed that the unit is listed in the header via "paramater_name[unit]". Under this system you might have "time[d]", "flux[μJy]", or "mag[AB_mag]".

Arguments

  • header::Vector{String}: The header, split by column
  • column_id::String: The name of the parameter in the column title
  • column_index::Int64: The index of the column in header
Supernovae.RunModule.PhotometryModule.parse_fileMethod
parse_file(lines::Vector{String}; delimiter::String=", ", comment::String="#")

Parse a file, splitting on delimiter and removing comments.

Arguments

  • lines::Vector{String}: A vector containing each line of the file to parse
  • ;delimiter::String=", ": What delimiter to split on
  • ;comment::String="#": What comments to remove. Will remove everything from this comment onwards, allowing for inline comments

SupernovaModule Functions

Public Objects

Supernovae.RunModule.SupernovaModule.SupernovaType
mutable struct Supernova

A Supernova

Fields

  • name::String: Supernova name
  • zeropoint::typeof(1.0u"AB_mag"): Zeropoint of the supernova
  • redshift::Float64: Redshift of the supernova
  • lightcurve::[Lightcurve](@ref): The lightcurve of the supernova
Supernovae.RunModule.SupernovaModule.SupernovaMethod
Supernova(data::Dict{String,Any}, config::Dict{String,Any})

Load in a supernova from data, which has a number of keys containing supernova data and options.

  • NAME::String: Name of the supernova
  • ZEROPOINT::Float64: Supernova zeropoint
  • ZEROPOINT_UNIT::String: Unitful unit of zeropoint, default to AB_mag
  • REDSHIFT::Float64: Supernova redshift
  • MAX_FLUX_ERR::Float64: Maximum allowed flux error, default to inf
  • MAX_FLUX_ERR_UNIT::String: Unitful unit of maximum flux error
  • PEAK_TIME::Union{Bool, Float64}: If bool, whether to set time relative to peak flux, if Float64, set time relative to PEAK_TIME
  • OBSERVATIONS::Vector{Dict{String,Any}}: Data to be turned into a Lightcurve

Private Objects

PlotModule Objects

Public Objects

Supernovae.RunModule.PlotModule.plot_lightcurve!Method
plot_lightcurve!(fig::Figure, ax::Axis, supernova::Supernova, plot_config::Dict{String, Any})

Add lightcurve plot to axis. plot_config contains plotting options.

DATATYPE = ["flux", "magnitude", "absmagnitude"]: The type of data to plot UNITS::Dict: Units for time, and flux, magnitude, or abs_magnitude NAMES::Vector: List of SupernovaModule.Observation.name's to include in the plot. If nothing, all observations are included RENAME::Dict: Convert FilterModule.Filter.passband to new name FILTERS::Vector: List of FilterModule.Filter.passband's to include MARKERSIZE::Int: Size of the markers MARKER::Dict: Marker to use for each SupernovaModule.Observation.name. If a passband is missing, a default marker is used COLOUR::Dict: Marker to use for each FilterModule.Filter.passband. If a passband is missing, a default marker is used LEGEND::Bool: Whether to include a legend

Arguments

  • fig::Figure: Figure to plot to
  • ax::Axis: Axis to plot to
  • supernova::Supernova: Supernova to plot
  • plot_config::Dict{String, Any}: Details of the plot
Supernovae.RunModule.PlotModule.plot_lightcurveMethod
plot_lightcurve(supernova::Supernova, plot_config::Dict{String,Any}, config::Dict{String,Any})

Set up Figure and Axis, then plot lightcurve using plot_lightcurve!

Arguments

  • supernova::Supernova: The supernova to plot
  • plot_config::Dict{String, Any}: Plot options passed to plot_lightcurve!
  • config::Dict{String, Any}: Global options including where to save the plot

Private Objects