https://github.com/duetosymmetry/savemetadata
Easy way to add your python script's source code as image metadata
https://github.com/duetosymmetry/savemetadata
matplotlib python reproducibility reproducible-science
Last synced: about 1 month ago
JSON representation
Easy way to add your python script's source code as image metadata
- Host: GitHub
- URL: https://github.com/duetosymmetry/savemetadata
- Owner: duetosymmetry
- License: mit
- Created: 2020-07-13T21:01:36.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-13T21:19:36.000Z (almost 5 years ago)
- Last Synced: 2025-02-01T22:41:21.486Z (3 months ago)
- Topics: matplotlib, python, reproducibility, reproducible-science
- Language: Python
- Homepage:
- Size: 23.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# savemetadata
Easy way to add your python script's source code as image metadata# Usage
You write a plotting script (here [`test.py`](test.py)). Inside, do the following:```python
from savemetadata import png_metadataimport matplotlib as mpl
# ... plotting code goes here ...
fig.figsave("figure.png", metadata=png_metadata())
```Your code generates the file `figure.png`. Its PNG metadata now stores your original script filename and source. This can later be extracted by using `savemetadata.extract_metadata_png("figure.png")` which returns a dict with keys `'name'` and `'contents'`.
# TODO
- Add `pdf_metadata()`
- Store the date/time (anything else?) when the script was run
- Wrap things so the user doesn't have to use `png_` or `pdf_`
- Add a CLI to extract from the figure and write new script files
- Inject into mpl's `figsave`?
- Introspect to see if this figure is generated using *multiple* python files?