Skip to content

BUG: Save ProfilePlot output inside directory paths - #5489

Open
Kkkakania wants to merge 1 commit into
yt-project:mainfrom
Kkkakania:agent/fix-profile-save-directory
Open

BUG: Save ProfilePlot output inside directory paths#5489
Kkkakania wants to merge 1 commit into
yt-project:mainfrom
Kkkakania:agent/fix-profile-save-directory

Conversation

@Kkkakania

Copy link
Copy Markdown

PR Summary

ProfilePlot.save() currently validates a directory path as an image name before adding the dataset basename, producing paths such as folder/.png_1d-Profile_radius_density. This change recognizes existing output directories first, appends the same dataset-based default name used by save(), and only then validates the image suffix.

A regression test saves a real profile plot into a temporary directory and verifies both the returned filename and the created file.

Fixes #5192.

PR Checklist

  • New features are documented, with docstrings and narrative docs
  • Adds a test for any bugs fixed. Adds tests for new features.

Verification

  • .venv/bin/python -m pytest yt/visualization/tests/test_profile_plots.py yt/visualization/tests/test_base_plot_types.py yt/visualization/tests/test_commons.py -q (50 passed)
  • .venv/bin/mypy yt/visualization/profile_plotter.py
  • uvx ruff check yt/visualization/profile_plotter.py yt/visualization/tests/test_profile_plots.py
  • uvx ruff format --check yt/visualization/profile_plotter.py yt/visualization/tests/test_profile_plots.py

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.

Incorrect behavior in ProfilePlot.save() when provided an output folder

1 participant