# Observation Model¶

## Basics¶

### beast.observationmodel.observations Module¶

Defines a generic interface to observation catalog This enables to handle non detections, (upper limits one day?), flux and magnitude conversions to avoid painful preparation of the dataset

Data model v2 with limited quantity units handling

#### Classes¶

`Observations` (inputFile[, desc]) |
A generic class that interfaces observation catalog in a standardized way |

`FakeObs` (inputFile[, desc]) |
Generate a data interface object |

`PhotCharact` (fname, filters) |

#### Class Inheritance Diagram¶

### beast.observationmodel.phot Module¶

#### Photometric package¶

Defines a Filter class and associated functions to extract photometry.

This also include functions to keep libraries up to date

Note

integrations are done using `trapz()`

Why not Simpsons? Simpsons principle is to take sequence of 3 points to
make a quadratic interpolation. Which in the end, when filters have sharp
edges, the error due to this “interpolation” are extremely large in
comparison to the uncertainties induced by trapeze integration.

#### Functions¶

`load_all_filters` ([interp, lamb, filterLib]) |
load all filters from the library |

`load_filters` (names[, interp, lamb, filterLib]) |
load a limited set of filters |

`load_Integrationfilters` (flist[, interp, lamb]) |
load a limited set of filters |

`extractPhotometry` (lamb, spec, flist[, absFlux]) |
Extract seds from a one single spectrum |

`extractSEDs` (g0, flist[, absFlux]) |
Extract seds from a grid |

`STmag_to_flux` (v) |
Convert an ST magnitude to erg/s/cm2/AA (Flambda) |

`STmag_from_flux` (v) |
Convert to ST magnitude from erg/s/cm2/AA (Flambda) |

`fluxToMag` (flux) |
Return the magnitudes from flux values |

`fluxErrTomag` (flux, fluxerr) |
Return the magnitudes and associated errors from fluxes and flux error values |

`magToFlux` (mag) |
Return the flux from magnitude values |

`magErrToFlux` (mag, err) |
Return the flux and associated errors from magnitude and mag error values |

`append_filter` (lamb, flux, tablename, …[, …]) |
Edit the filter catalog and append a new one given by its transfer function |

`appendVegaFilter` (filtInst[, VegaLib]) |
Add filter properties to the Vega library |

#### Classes¶

`Filter` (wavelength, transmit[, name]) |
Class filter Define a filter by its name, wavelength and transmission |

`IntegrationFilter` (wavelength, transmit[, name]) |
Class filter |

#### Class Inheritance Diagram¶

### beast.observationmodel.vega Module¶

Handle vega spec/mags/fluxes manipulations

#### Functions¶

`from_Vegamag_to_Flux` (lamb, vega_mag) |
function decorator that transforms vega magnitudes to fluxes (without vega reference) |

#### Class Inheritance Diagram¶

## Noise Model¶

### beast.observationmodel.noisemodel.noisemodel Module¶

#### Classes¶

`NoiseModel` (astfile, *args, **kwargs) |
Initial class of noise models |

#### Class Inheritance Diagram¶

### beast.observationmodel.noisemodel.toothpick Module¶

Toothpick noise model assumes that every photometric band is independent from the others.

The following package implements two classes that corresponds to two variants of input AST data.

the first `MultiFilterASTs`

assumes that all AST information is compiled
into on single table, in which one entry corresponds to one artificial star
and recovered values

the second `perCameraASTs`

assumes that the information is split into
multiple tables, and implements the equivalent of multiple instances of
`MultiFilterASTs`

in parallel to calculate the model.

#### Method¶

The noise model is computed in equally spaced bins in log flux space to avoid injecting noise when the ASTs grossly oversample the model space. This is the case for single band ASTs - this is always the case for the BEAST toothpick noise model.

- TODO:
- +++ perCameraASTs has not been updated - delete? Does not work with PHAT single camera ASTs - column names duplicated

#### Classes¶

`MultiFilterASTs` (astfile, filters, *args, …) |
Implement a noise model for which input information of ASTs are provided as one single table |

#### Class Inheritance Diagram¶

### beast.observationmodel.noisemodel.trunchen Module¶

Trunchen version of noisemodel Goal is to compute the full 6-band covariance matrix for each model

#### Classes¶

`MultiFilterASTs` (astfile, filters, *args, …) |
Implement a noise model where the ASTs are provided as a single table |

#### Class Inheritance Diagram¶

### beast.observationmodel.noisemodel.generic_noisemodel Module¶

Generates a generic noise model from artifical star tests (ASTs) results
using the toothpick method. Using ASTs results in a noise model that
includes contributions from measurement (photon) noise *and* crowding
noise.

Toothpick assumes that all bands are independent - no covariance. This is a conservative assumption. If there is true covariance more accurate results with smaller uncertainties on fit parameters can be achieved using the trunchen method. The trunchen method requires significantly more complicated ASTs and many more of them.

#### Functions¶

`make_toothpick_noise_model` (outname, astfile, …) |
toothpick noise model assumes that every filter is independent with any other. |

`get_noisemodelcat` (filename) |
returns the noise model |

#### Classes¶

`Generic_ToothPick_Noisemodel` (astfile, …) |