Skip to content

Conversation

@chanshing
Copy link
Member

Add --csv-txyz-idxs and rename --txyz to --csv-txyz

Add option to specify CSV columns by index, and rename --txyz to --csv-txyz for consistency.

Breaking Changes

  • --txyz renamed to --csv-txyz

Usage

# By column name (renamed from --txyz)
stepcount data.csv --csv-txyz 'time,x,y,z'

# By column index (new)
stepcount data.csv --csv-txyz-idxs '0,1,2,3'

# If time is 4th column, x/y/z are 1st/2nd/3rd
stepcount data.csv --csv-txyz-idxs '3,0,1,2'

--csv-txyz-idxs takes precedence over --csv-txyz when both are set.

Files Changed

src/stepcount/stepcount.py

  • Rename --txyz to --csv-txyz
  • Add --csv-txyz-idxs argument

src/stepcount/utils.py

  • Add csv_txyz_idxs parameter to read()
  • Parse and validate indices (4 non-negative integers)
  • Read CSV header to map indices to column names
  • Raise ValueError for invalid or out-of-range indices
  • Simplify warning message for non-CSV files

**src/stepcount/stepcount.py**
- Rename --txyz to --csv-txyz for consistency with other CSV options
- Add --csv-txyz-idxs for specifying columns by index (e.g., '0,1,2,3')

**src/stepcount/utils.py**
- Add csv_txyz_idxs param to read()
- Parse and validate indices (must be 4 non-negative integers)
- Read CSV header to map indices to column names
- Raise ValueError for out-of-range or invalid indices
- Simplify warning message for non-CSV files
@chanshing chanshing merged commit e19deb6 into main Dec 10, 2025
9 checks passed
@chanshing chanshing deleted the feat/csv-txyz-idxs branch December 10, 2025 11:10
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