Skip to content

Mm rework lingfeng#21

Open
hustonm wants to merge 120 commits into
mm_reworkfrom
mm_rework_lingfeng
Open

Mm rework lingfeng#21
hustonm wants to merge 120 commits into
mm_reworkfrom
mm_rework_lingfeng

Conversation

@hustonm

@hustonm hustonm commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

No description provided.

wei-lingfeng and others added 30 commits September 9, 2025 20:10
Update data fitting logic: Compare observed data points with model parameters. If n_obs < n_params, return fill value for the parameters and infinity for the uncertainties; Otherwise, calculate parameters normally. If n_obs = n_params and absolute_sigma=False, return infinity for uncertainties (Same behavior as scipy curve fit).
…motion models. Update fitting logic: Provide multiple motion models, use the available model with the most number of parameters to fit according to the observed data points (i.e., choose the model with n_obs >= n_params). Removed motion_model_input and default_motion_model for clarity.
…atch_pos at_time into model; Renamed get_ functions into calc_ functions
… and get_batch_pos_at_time into model; Replaced MotionModel.fit_motion_model with MotionModel.fit; Rewrote and accelerated StarTable.fit_velocities with StarTable.fit_motion_model
Comment thread flystar/starlists.py Outdated
if ('me' not in cols) and ('snr' in cols) and (error == True):
t_ref['me'] = 1.0 / t_ref['snr']

# if ('me' not in cols) and ('snr' in cols) and (error == True):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use this option in our microlensing work, and I would like to un-comment it. Does it cause an error in your use case?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh certainly not. But it seems HST still uses 'me' column and in your case 'snr' column? Do we need to differentiate these above in line 649 too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we need to be able to use 'snr' for Keck data. This has never been an issue with our HST data since those tables already have column headers. Do yours not?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted back to snr. Need to fix in hst_flystar

Comment thread flystar/align.py
Comment thread flystar/align.py Outdated
Comment thread flystar/startables.py Outdated
self.meta[param] = value

if raise_key_error:
raise KeyError(f"fit_motion_models: Missing required fixed parameter(s) for the motion models used: {', '.join(missing_params)}! Please provide them in fixed_params_dict or as columns in the table.")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this also check the table metadata for the value too before throwing an error? I think that will be much more common than a full data column

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the check

Comment thread flystar/startables.py Outdated
return

def shift_reference_frame(self, delta_vx=0.0, delta_vy=0.0, delta_pi=0.0,
motion_model_dict={}):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These functions (class method and standalone) have been broken with these changes. A fix would be appreciated, but I can also make it if needed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean the return type of this function? Actually, I don't call this function anymore in align, so technically I need to remove it in this branch. It is replaced by the motion_model.infer_positions function. Do you still call this function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean the shift_reference_frame functions. They throw errors because the structure of motion models changed. Which function do you mean you might remove?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just updated the shift_reference_frame function, but I don't have a test case for it. I meant to remove the get_star_positions_at_time function, which I replaced with infer_positions

Comment thread flystar/align.py Outdated
trans_class=transforms.PolyTransform,
trans_args=[{'order': 2}, {'order': 2}],
trans_input=None,
trans_weighting=None,

@hustonm hustonm Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert these weighting/weights keywords for user continuity

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted the align argument keywords (but kept the attribute name inside the class)

Comment thread flystar/startables.py
@jluastro

jluastro commented Jul 10, 2026 via email

Copy link
Copy Markdown
Collaborator

@wei-lingfeng

Copy link
Copy Markdown
Collaborator

@jluastro This is a new function in the mm_rework branch only, so I don't think it will affect backward compatibility until the merge is complete and pushed to dev or main. Plus, the API has drastically changed from mm_rework to make things faster, which this pull request is meant to do. mm_rework_lingfeng -> mm_rework -> public dev/main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants