visualdynamics.core.photos¶
photos
¶
Photos: pictures of the test, saved in the project.
A Photos object is an ordered set of named images, such as the setup and instrumentation photos used in a test report. It keeps the file bytes exactly as read (PNG or JPEG), so nothing is re-encoded and the same bytes go into the project file and the report.
Classes:
| Name | Description |
|---|---|
Photos |
Named images, in the order they were added. |
Classes¶
Photos
¶
Photos(names: Sequence[str] | None = None, formats: Sequence[str] | None = None, images: Sequence[bytes] | None = None)
Named images, in the order they were added.
Setup photos (where the accelerometers were placed, how the test
article was supported) belong with the data they document, so they
are a project object like any other and are saved in the .vdyn
file. The bytes are kept encoded as they were read, not decoded into
arrays, because a report embeds them and re-encoding a JPEG to store
it would reduce its quality.
Attributes:
names: The name of each photo, which is also its caption in a
report.
formats: The encoding of each, for example 'png' or 'jpeg'.
images: The encoded bytes, one per photo.
Raises ValueError if names, formats and images differ in
length.
Methods:
| Name | Description |
|---|---|
rename |
Rename the photo at |
delete_photos |
Remove the photos at |
add_file |
Add a PNG or JPEG file, named after the file without its extension. |
plot |
Show the photos at |
Source code in src/visualdynamics/core/photos.py
Methods:¶
rename
¶
Rename the photo at index.
Raises ValueError if the name is blank or another photo already has it.
Source code in src/visualdynamics/core/photos.py
delete_photos
¶
Remove the photos at picks (indices).
Source code in src/visualdynamics/core/photos.py
add_file
¶
Add a PNG or JPEG file, named after the file without its extension.
If a photo already has that name, a number is added, as in
'setup (2)'. Returns the name given to the photo. Raises
ValueError for any other kind of file.
Source code in src/visualdynamics/core/photos.py
plot
¶
Show the photos at picks (all of them by default) as the app shows them.