Skip to content

SSEP‐4 ‐ Modeling and Fitting

Shane Maloney edited this page Apr 24, 2025 · 3 revisions

SSEP-4 -- Modeling and Fitting

SSEP 4
Title Modeling
Author(s) First Last
Contact Email me@myemail.org
Date-created YYYY-MM-DD
Date-updated YYYY-MM-SS
Type Standard
Discussion link to discussion if available
Status < Discussiom | Accepted | Rejected >

Introduction

Modeling observed spectra with functional or physical models is a core function of sunkit-spex.

Note

There is somme tight coupling between modeling, fitting maybe should be in on SSEP

Detailed Description

Modeling requirements:

  • Support units in some form
  • N-dimensional
  • Support broadcasting
  • Support parameter handling
  • Model composition (basic operators, piping, chaining )
  • Altering the independent variable in the fit (e.g. gain & offset correction)
  • Complex Physical models e.g spatially or temporal dependence (e.g. X-ray directivity)
  • User defined models

Candidate Libraries Packages

🟢🟡🟠🔴

Req \ Astropy Modeling LMFit Sherpa GammaPy
Units 🟡 🔴 ?
N-dimensional 🟠 ? ?
Broadcasting 🟢 ? ?
Parameters 🟢 🟢 🟢 🟢
Model composition 🟡 🟡 🟠 ?
Altering Independents 🔴? ? 🟡 ?

Really nice AST evaluation feature to parse user defined models

Seems insired by Astrpoy modeling but

Simultaneous fitting is supproted but

For simultaneous fits the same optimisation and statistic needs to be used for each fit (this is an area we are looking to improve):

Proposal

Create an astropy modeling like system follow a similar API but remove some of the constraints currently

class Model:
    r"""
    A base model class

    Parameters
    ----------
    inputs : array or quantity 
         

    *parameters : 
    """

    def __init__(inputs=None *parameters):
        self.inputs=inputs

    def evaluate(self, input=None, *parameters
        r"""
 
        """
        if input is None and self.input is None
            raise Error()

         

    def _model_for_fitting()
        r"""
        Return a model for fitting 

        Handels fixed and tied parameters etc
        """
        

     

Decision Rationale

This is a great idea because...

Clone this wiki locally