The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA...

21
The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14

Transcript of The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA...

Page 1: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

The Magic of B-Splines

Adam S. BoltonIfA Astrocoffee2008 March 14

Page 2: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

B-splines

o For “basis splines” (I think...)

o When you need to fit an arbitrarily complicatedsmooth model to an arbitrarily complicated data set.

o Think of them as a cross between a fit and aninterpolation.

o Piece-wise polynomial of order n (by convention,n=2 is linear, n=3 is quadratic, n=4 is cubic,etc.), continuous at “breakpoints” throughderivative order n-2, cast in terms of localizedbasis functions that are fitted linearly to thedata in a least-squares sense.

Page 3: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

The “truth”...

Page 4: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

... with some finite sampling...

Page 5: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

... and errors...

Page 6: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

... and of course we don’tactually know what the truth is.

Page 7: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

We can break it up into binsdelineated by “breakpoints”...

Page 8: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

... and compute a binned average.This is an “order n=1” B-spline.

Page 9: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

For piece-wise continuity, we canuse and “order n=2” B-spline.

Page 10: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

For continuity of slope, use an“order n=3” B-spline.

Page 11: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

For continuity of slope andcurvature, an “order n=4” B-spline.

Page 12: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

Not a bad approximation to the“truth”

Page 13: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

Not a bad approximation to the“truth”

Page 14: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

Advantages of B-splineso Linear model => one-shot parameter solution.

o “Local” basis functions => band-diagonal matrix to invert, limited parameter covariance.

o Smoothness & continuity built in.

o Breakpoint spacing arbitrarily adjustable.

o Another independent variable can be incorporatedthrough multiplication of basis functions by low-order global function (e.g., polynomial ormultipole) of that 2nd variable.

Page 15: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

Application: flatfielding, modelingand extraction of fiber spectroscopy

Figure from Bolton & Burles 2007Also SDSS 2D spectro pipeline (Burles & Schlegel)

Data B-spline model= fiber flat

Data / model= pixel flat

Page 16: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

Application: flatfielding, modelingand extraction of fiber spectroscopy

Data Extraction model

Data w/ model CR rejection Residual (Bolton &Burles 2007)

Page 17: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

Application: sky subtraction forfiber spectroscopy

Figure from Bolton & Burles 2007Also see SDSS 2D spectro pipeline (Burles & Schlegel)Also see Kelson 2003

~7700 Ang

~8100 Ang

Page 18: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

Application: sky subtraction forfiber spectroscopy

Bolton &Burles 2007

Page 19: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

Application: Elliptical galaxysurface-brightness modeling (usingmultipole angular dependence)

Bolton et al. 2006, 2008a

Page 20: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

Key B-spline references/resources

o Carl de Boor, numerous publications, esp. “A practical guide to splines”

o IDL implementation of S. Burles & D. Schlegel: http:// spectro.princeton.edu/ (“idlutils”)

o Also implemented in Fortran, C, and Python (I believe...)

Page 21: The Magic of B-Splines - Astronomybolton/bspline08.pdf · The Magic of B-Splines Adam S. Bolton IfA Astrocoffee 2008 March 14. B-splines o For “basis splines” (I think ... “A

Thank you!