General Fitting - Lecture Notes - Astronomical Data Analysis | AST 5765, Study notes of Astronomy

Material Type: Notes; Class: ADV ASTRONOMICAL DATA ANALYSIS; Subject: Astronomy; University: University of Central Florida; Term: Fall 2009;

Typology: Study notes

Pre 2010

Uploaded on 02/25/2010

koofers-user-yox
koofers-user-yox 🇺🇸

4

(1)

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
UCF Physics: AST 5765/4762: (Advanced) Astronomical Data Analysis
Fall 2009 Lecture Notes: 13. General Fitting
1 Check In: 12:30 12:35, 5 min
Questions before we start?
Level check
2 General Linear Fitting: : :, 10+5 min
First example extends the line fit to linear scaling of arbitrary models
This is a quick-and-dirty method, useful because everyone has a linfit routine
Take each prediction of a nominal model,
Multiply by a constant,
Add another constant
2 free parameters, like a line fit
Can use linear fitting routine to find parameters
Calculate a “nominal” model
Treat xas the parameter in a parametric equation
Calculate model for xvalues in data
Pair those with yvalues in data
Plot d=ydata vs. m=ymodel
No error in m, but error in d
So, dgoes on vertical axis
Fit a line!
Slope is how much you multiply model by
Intercept is how much you add to model
If model has just multiply parameter, intercept is used as a final background fit
Can still do if data are in more than 2 axes
E.g., model depends on xand yin an image
fitting demo
1
pf2

Partial preview of the text

Download General Fitting - Lecture Notes - Astronomical Data Analysis | AST 5765 and more Study notes Astronomy in PDF only on Docsity!

UCF Physics: AST 5765/4762: (Advanced) Astronomical Data Analysis

Fall 2009 Lecture Notes: 13. General Fitting

1 Check In: 12:30 — 12:35, 5 min

  • Questions before we start?
  • Level check

2 General Linear Fitting: : — :, 10+5 min

  • First example extends the line fit to linear scaling of arbitrary models
  • This is a quick-and-dirty method, useful because everyone has a linfit routine
  • Take each prediction of a nominal model,
  • Multiply by a constant,
  • Add another constant
  • 2 free parameters, like a line fit
  • Can use linear fitting routine to find parameters
    • Calculate a “nominal” model
    • Treat x as the parameter in a parametric equation
    • Calculate model for x values in data
    • Pair those with y values in data
    • Plot d = ydata vs. m = ymodel
    • No error in m, but error in d
    • So, d goes on vertical axis
    • Fit a line!
    • Slope is how much you multiply model by
    • Intercept is how much you add to model
    • If model has just multiply parameter, intercept is used as a final background fit
  • Can still do if data are in more than 2 axes
  • E.g., model depends on x and y in an image
  • fitting demo 1

3 Function Minimization Fitting: : — :, 10+5 min

  • Linear fitting doesn’t work if there is more than a multiply and an add parameter
  • E.g., multiply, add, and shift
  • Could derive a new expression like linear least squares formulae
  • Or, do it numerically:
    • Define an Python function that has parameters of model as inputs
    • Usually the parameters are in a vector
    • Run scipy.optimize.leastsq on the data with the function
    • It finds the optimal values, and errors!
    • Can be slow, depending on model and data space
    • Can be fooled if data space is strange: local minima in χ^2 space
  • What scipy.optimize.leastsq does is:
    • Evaluate the function
    • Compute χ^2 vs. data
    • Vary the parameters and repeat
  • It explores parameter space, looking for the minimal χ^2
  • It uses a function minimization routine
  • Calculates gradients in χ^2 and walks down them
  • Parameter errors are related to slopes near χ^2 minimum
  • fitting demo 2