Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/point redesign #334

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Feature/point redesign #334

wants to merge 11 commits into from

Conversation

Jammy2211
Copy link
Owner

In order to help @jhod0 begin implementing new point source function, I have done a redesign and refactor of the point module.

This does the following:

  • Docstrings throughout the module, to make it clearer what different classes do.
  • Incorporates magnification into the source-plane chi-squared calculation currently supported.
  • Moves the image-plane chi-squared all-to-all calculation to the correct Fit object.
  • Refactors FitPoint hierarchy to be clearer.

I am not overly keen on the design of the point/fit package yet, with inheritance used a lot and quite confusing. But I don't have the capacity for a full redesign yet, and think we should wait until everything works with JAX before moving more stuff around.

The merit of this design is that it mirrors other Fit objects throughout PyAutoLens, which is important for using functionality like the aggregator. It also means the API when you have a fit, e.g. after a model-fit, is quite clear and easy to use and contains everything:

fit = al.FitPointDataset(
    dataset=dataset,
    tracer=tracer,
    solver=solver,
    fit_positions_cls=al.FitPositionsImagePair,  # Different input to the one used above
)

print(
    "Minimum Distance Between Observed Multiple Images and Model Multiple Images Without Repeats:"
)
print(fit.positions.residual_map)

print("Log Likelihood Without Repeats:")
print(fit.positions.log_likelihood)

# IF FLUXES WERE INCLUDED

print(fit.fluxes.log_likelihood)

This should help us get started.

@Jammy2211 Jammy2211 requested a review from rhayes777 January 29, 2025 13:44
Comment on lines +65 to +67
self.profile = (
tracer.extract_profile(profile_name=name) if profile is None else profile
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

self.profile = profile or tracer.extract_profile(profile_name=name)

Copy link
Collaborator

Choose a reason for hiding this comment

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

This extract_profile stuff looks a bit whacky to me

Comment on lines +65 to +66
data_position: np.array,
model_position: np.array,
Copy link
Collaborator

Choose a reason for hiding this comment

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

np.ndarray

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.

2 participants