Skip to main content

file-tag-parser

Package PyPI Latest Release

A tag-based filename parser for imaging data.

This library is designed to make parsing of arbitrary filenames attainable and searchable via a pandas-based database. Each filename can then be interpreted and/or manipulated for whatever processing and analysis is desired.

At the moment, the library is solely dedicated to the interpretation of complex filenames using a "tagging system", to streamline their grouping and loading. This will likely be expanded in the future as needed.

Below are the details for how the file tag parser works. This allows the program to easily handle filename structures from different devices and groups, by extracting "tags" from the filename that have meaning in the context of data analysis.

Filename strings and tags

Filename tags are highly useful for grouping datasets for processing and analysis. Each of the tags below will be extracted from the filename if it is contained within braces.

Tag Description
IDnum The ID of the participant that was imaged.
VidNum The acquisition number that the data corresponds to. This tag MUST be present for F(Cell) to work! All data may share modalities but not video numbers.
Year The year the data was obtained, in YYYY format.
Month The month the data was obtained, in MM format.
Day The day the data was obtained, in DD format.
Hour The hour the data was obtained, in HH format. Either 12 hour or 24 clocks are allowed.
Minute The minute the data was obtained, in MM format.
Second The second the data was obtained, in SS format.
Eye The eye the data was obtained from. There are no restrictions on use of OS/OD or left/right.
LocX The azimuthal (X) location that the data was obtained from. Usually corresponds to temporal/nasal eccentricity relative to the locus of fixation, but can be in any type of coordinate. Example: 4T
LocY The polar (Y) location that the data was obtained from. Usually corresponds to superior/inferior eccentricity relative to the locus of fixation, but can be in any type of coordinate. Example: 9S
LocZ The radial (Z) location that the data was obtained from. Usually corresponds to the focus of the device, but can be in any type of coordinate (especially if using OCT). Example: 0.15D
FOV_Width The field of view width. Usually in degrees, but can be anything.
FOV_Height The field of view height. Usually in degrees, but can be anything.
FOV_Depth The depth of field.
Modality The modality that the data was obtained from, in devices that have multiple modes/channels. Example: 760nm
QueryLoc The name of the query locations. Very useful for datasets with multiple possible coordinate sets. Can be an empty field, as well; to make this field optional, add :s? to the end. Example: {QueryLoc:s?}

Example filenames and tags

Example 1:

For an image filename with the following format:

8675309_OD_1776_850nm_AVG.tif

and tag string:

{IDnum}_{Eye}_{VidNum}_{Modality}_AVG.tif

The program would store the following tags in the pandas database:

IDNum = "8675309"
Eye = "OD"
VidNum = "1776"
Modality = "850nm"

Example 2:

For an video filename with the following format:

hellothere_OD_1861_split_det_favorite.avi

and tag string:

{IDnum}_OD_{VidNum}_{Modality}_favorite.avi

The program would store the following tags in the pandas database:

IDNum = "hellothere"
VidNum = "1861"
Modality = "split_det"

Example 3: Ignoring tags.

If your filenames have changing numbers that should be grouped together but file-tag-parser doesn't have a tag for them, they can be blank (ignored) fields. For example:

Video 1: hellothere_OD_1861_split_det_vanilla.avi Video 2: hellothere_OD_1861_confocal_chocolate.avi

and tag string:

{IDnum}_OD_{VidNum}_{Modality}_{}.avi

file-tag-parser would store the following tags for use in other analysis steps:

Video 1:

IDNum = "hellothere"
VidNum = "1861"
Modality = "split_det"

Video 2:

IDNum = "hellothere"
VidNum = "1861"
Modality = "confocal"

Example 4: Optional fields

In some cases, for example in query location files, files may take on a form that sometimes includes modifiers and other times does not. Optional fields automatically strip out common "separator" characters, (e.g. -, _, , etc.) Optional fields are delineated in a tag string as follows:

{Fieldname:s?}

So for query location files:

Query Locations 1: hellothere_OD_1861_split_det_vanilla_coords.csv

Query Locations 2: hellothere_OD_1861_split_det_vanilla_subset_coords.csv

and tag string:

{IDnum}_OD_{VidNum}_{Modality}_{}_{QueryLoc:s?}coords.csv

file-tag-parser would store the following tags in the database:

Query Locations 1:

IDNum = "hellothere"
VidNum = "1861"
Modality = "split_det"
QueryLoc = ""

Query Locations 2:

IDNum = "hellothere"
VidNum = "1861"
Modality = "split_det"
QueryLoc = "subset"

Metadata

Release files for file-tag-parser 0.2.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for file-tag-parser 0.2.5.4
File Size Uploaded
file_tag_parser-0.2.5.4.tar.gz 12.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for file-tag-parser 0.2.5.4
File Interpreter ABI Platform
file_tag_parser-0.2.5.4-py3-none-any.whl Python 3 none any Details

Total release size: 22.0 kB

Release files / file_tag_parser-0.2.5.4.tar.gz

Download URL file_tag_parser-0.2.5.4.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9f42262bff243f2d43a424c67d78a7aa5f399ac2c73ee08e0e906a8655d3adab
BLAKE2b-256 checksum
How to use checksums
9cbecbd6f6e97d62fdd9513001d9a2430a09680288b934528b4f78c8357cdcac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / file_tag_parser-0.2.5.4-py3-none-any.whl

Download URL file_tag_parser-0.2.5.4-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7cdbe602b6c192a960c3a2419e6f28f74c859852c9c1d9170a2858ae9219e810
BLAKE2b-256 checksum
How to use checksums
3aca74f98c3aab67db7a95ae1410fcebe59ba42070764f33682308a579a31352
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.2.5.4 This release

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page