Skip to content

Feature/adapt loading#160

Merged
Jammy2211 merged 11 commits intomainfrom
feature/adapt_loading
Apr 8, 2024
Merged

Feature/adapt loading#160
Jammy2211 merged 11 commits intomainfrom
feature/adapt_loading

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Recent updates changed it so that the AdaptImages were computed and passed to an Analysis object during search chaining pipelines.

However, this meant resuming already completed pipelines is slow, because the adapt images would be computed for each fit even though for fits that are already completed the adapt images are not used.

This PR instead uses an AdaptImageMaker object, which computes the AdaptImages when they are used and then caches them. This means pipelines can be resumed much faster again.


from autogalaxy.analysis.adapt_images.adapt_images import AdaptImages

class AdaptImageMaker:
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.

There's a not a huge amount of point in this class given that you could simply call:

result.adapt_images_from(
    use_model_images=self.use_model_images
)

Comment on lines +117 to +118
if isinstance(paths, af.DatabasePaths):
return
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.

Why the exception here? Might be cleaner to put this outside the function

settings typically control the overall run-time.
"""

if paths is None:
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.

Same here

Comment on lines +64 to +70
@property
def preloads_cls(self):
return Preloads

@property
def fit_maker_cls(self):
return FitMaker
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.

You can also do this by setting class level attributes.

class AnalysisDataset(Analysis):
    Preloads = Preloads
    FitMaker = FitMaker

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Going to do this in a moment when I do it for the Result casting.

Comment on lines +139 to +140
os.makedirs(paths.profile_path, exist_ok=True)
self.preloads.output_info_to_summary(file_path=paths.profile_path)
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.

Handle directory creation right before the data is output (e.g. in the output_info_to_summary method)

@Jammy2211 Jammy2211 merged commit e0e5793 into main Apr 8, 2024
@Jammy2211 Jammy2211 deleted the feature/adapt_loading branch March 24, 2025 19:48
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