# Galaxy Modeling To-Do List

## Solver Robustness (FIXED)

At least part of the problem in "dataset 0" - where our stars were being fit with de Vaucouleur profiles - was that our quadratic programming solver was throwing exceptions when it encountered matrices that weren't positive definite. Because the Fisher matrix often goes semidefinite at zero radius, we were effectively not trying zero radius for most stars on some CCDs (including "dataset 0"). This has been fixed in #1725.

The results: on "dataset 0", the offset of the stellar locus relative to the PSF mags is reduced (though it's still not as good as other datasets) and the stars change from deVauc dominated to shapelet (n=2 ring) dominated. It's an improvement, but not a fix.

## Diagnostics

• Add another row to the DS9 viewer, with a pure PSF fit. We need to see exactly why the delta-function components are not preferred in dataset 0, even with a more robust solver.

## Better Optimizers

• We can take another step towards a real optimizer by doing some simple bisection (or something similar) on our 1-d radius grid. In particular, if we try r=0 first, and we find that the next point is worse, we try in between instead of a larger radius.
• Instead of stepping in ellipticity space on a grid, use shapelet multiple matrix to estimate the ellipticity that would set the shapelet ellipticity terms to zero. Maybe try it every step in radius, or maybe just at best radius. It may be possible to do the same trick for radius, but that's likely to be a lot less stable and needs some sort of trust-region treatment.
• From RHL: try fitting linear combinations of models with different nonlinear parameters (i.e. radii). Need to think about how best to do this with the current API (hackish add-on in SourceMeasurement, or a feature for Grid?)

## Better Input Handling

• See some outliers where the centroid is on the edge of the footprint. Consider using a footprint that is an OR of the detection with the adaptive moments ellipse, but that requires footprint OR code that doesn't exist in afw. Alternately just find a way to flag those and skip them (or they already flagged?)

## Weekly Run Stuff

• It'd be nice to see how we do with improved PSF models.
• Need to verify that all the #1700 structural changes didn't introduce new rare-object crashing or hanging that we miss on our smaller runs.
• Need to update meas_multifitData, and this time remember where it came from.

## Coding Practices

• Changes in #1700(a) replace getParameterSize() with getParameterCount(), etc. in Evaluator. Should use "count" when it fits, and "size" only when "count" really doesn't (like Basis::getSize).
• Consistency in shortening "parameters", "coefficients" to "params", "coeffs". I vote we don't do it at all.

## Interface and Ease-of-Use

• Serialization for Definition, so we can freeze problems and debug them in isolation.
• Now that we're using multiple-component models, it would be nice to have some convenience methods to make them (including shared elements and flux groups).