You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Name the module motion_models, and alias it where the argument shadows it
The module keeps the underscore, as preferred. What cannot move is the other
side of the collision: every `motion_models` binding in the package is either
the public keyword argument of MosaicSelfRef, MosaicToRef, fit_motion_models,
infer_positions, determine_motion_models and organize_motion_models, or that
same parameter reassigned inside its own function. Renaming it would change the
documented API that the examples, the notebook and outside scripts call, which
is a much larger break than a module name.
So the two library files that use both -- align.py and startables.py -- import
the module as `mmodels`, with a comment at the import saying why, and
test_align.py does the same for the local of that name in several of its tests.
Everywhere the name is free (transforms.py, the other tests, the docs, the
notebook, the benchmark script) it is imported and referred to plainly as
motion_models.
Verified beyond the suite that the shadowed call path still works from outside:
fit_motion_models(motion_models=['Linear']) on a table fits Linear, and
organize_motion_models('linear') resolves, with flystar.motion_models importable
under its own name. Full suite passes, docs build clean, and the API reference is
back at api/flystar/motion_models/.
"/Users/lwei-local/Software/flystar/flystar/motionmodels.py:346: OptimizeWarning: Degree of freedom <= 0 for some star(s). Covariance of the parameters could not be estimated. Setting parameter uncertainties to np.inf.\n",
879
+
"/Users/lwei-local/Software/flystar/flystar/motion_models.py:346: OptimizeWarning: Degree of freedom <= 0 for some star(s). Covariance of the parameters could not be estimated. Setting parameter uncertainties to np.inf.\n",
# missing_params = [param for param in motion_model_params if (param not in self.ref_list.colnames) and (f'{param}_err' not in self.ref_list.colnames) and (param not in self.fixed_params_dict.keys())]
2621
2625
# if len(missing_params) > 0:
2622
2626
# warnings.warn("Warning: 'motion_model_used' column found in ref_list, but the following motion model parameter columns are missing: " + ", ".join(missing_params) + ". Removing 'motion_model_used' column to avoid confusion.")
@@ -2995,8 +2999,8 @@ def infer_positions(t, startable, motion_models=None, fixed_params_dict=None, re
2995
2999
ifmotion_modelsisNone:
2996
3000
# Setting the default to None to avoid mutable default argument issue
2997
3001
# See https://stackoverflow.com/questions/15189245/assigning-class-variable-as-default-value-to-class-method-argument
0 commit comments