Skip to content

Feature/point redesign#334

Merged
Jammy2211 merged 12 commits into
mainfrom
feature/point_redesign
Feb 20, 2025
Merged

Feature/point redesign#334
Jammy2211 merged 12 commits into
mainfrom
feature/point_redesign

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

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 thread autolens/point/fit/abstract.py Outdated
Comment on lines +65 to +67
self.profile = (
tracer.extract_profile(profile_name=name) if profile is None else profile
)
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.

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

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.

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
Copy Markdown
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