Skip to content

Feature/fits reconstruction#228

Merged
Jammy2211 merged 3 commits intomainfrom
feature/fits_reconstruction
Apr 29, 2025
Merged

Feature/fits reconstruction#228
Jammy2211 merged 3 commits intomainfrom
feature/fits_reconstruction

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Comparing main...feature_fits_reconstruction · Jammy2211_PyAutoLens

@Jammy2211 Jammy2211 requested a review from rhayes777 April 13, 2025 18:20
with open(
self.image_path / f"inversion_reconstruction_{i}.csv",
mode="w",
newline="",
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 pass newline="" here?

Comment on lines +64 to +72
with open(path.join(plot_path, "inversion_reconstruction_0.csv"), mode="r") as file:
reader = csv.reader(file)
header_list = next(reader) # ['y', 'x', 'reconstruction', 'noise_map']

reconstruction_dict = {header: [] for header in header_list}

for row in reader:
for key, value in zip(header_list, row):
reconstruction_dict[key].append(float(value))
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.

A similar (although not quite the same) behaviour can be obtained using csv.DictReader

reader = csv.DictReader(file)
list(reader)[0]
> {'y': 1, 'x': 2, ...}

@Jammy2211 Jammy2211 merged commit 040d5d6 into main Apr 29, 2025
8 checks passed
@Jammy2211 Jammy2211 deleted the feature/fits_reconstruction branch April 30, 2025 18:15
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