Skip to content

Add logs and metadata directories for centralized file organization (Fixes #308)#776

Open
abuzarmahmood wants to merge 2 commits into
masterfrom
openhands/issue-308-logs-metadata-dirs
Open

Add logs and metadata directories for centralized file organization (Fixes #308)#776
abuzarmahmood wants to merge 2 commits into
masterfrom
openhands/issue-308-logs-metadata-dirs

Conversation

@abuzarmahmood
Copy link
Copy Markdown
Member

Summary

This PR addresses issue #308 by reorganizing log and metadata file storage in the blech_clust project:

Changes Made

1. Created centralized logs/ directory for all log files:

  • output.log (via Tee class)
  • results.log (blech_init.py)
  • ram_usage.log (ram_monitor.py)
  • blech_process.log (blech_process.py)
  • umap_results.log (umap_plots.py)
  • execution_log.json (pipeline_graph_check in blech_utils.py)

2. Created centralized metadata/ directory for all metadata files:

  • electrode_layout_frame.csv (blech_exp_info.py)
  • trial_info_frame.csv (blech_make_arrays.py, ephys_data.py, and others)
  • dig_in_frame.csv (read_file.py)
  • *.info file (blech_utils.py - imp_metadata class)
  • *.params file (blech_utils.py - imp_metadata class)
  • aggregated_characteristics.csv (blech_units_characteristics.py)
  • unit_descriptor.csv (blech_post_process.py)
  • unit_profile.csv (ephys_data.py)
  • waveform_classifier_recommendations.csv (blech_process_utils.py)

3. Added helper functions in blech_utils.py:

  • ensure_dir(data_dir, subdir) - Creates a subdirectory if it doesn't exist
  • get_metadata_dir(data_dir) - Returns path to metadata directory
  • get_logs_dir(data_dir) - Returns path to logs directory
  • find_file_in_dir(data_dir, filename_pattern) - Helper for backward compatibility

4. Maintained backward compatibility:

  • All reading functions check both the new location (metadata/ or logs/) and the old location (data directory root)
  • If files exist in the old location, they are used; otherwise, files are created in the new location

Files Modified

  • blech_exp_info.py
  • blech_init.py
  • blech_make_arrays.py
  • blech_post_process.py
  • blech_process.py
  • blech_units_characteristics.py
  • emg/emg_freq_setup.py
  • utils/blech_data_summary.py
  • utils/blech_process_utils.py
  • utils/blech_utils.py
  • utils/ephys_data/ephys_data.py
  • utils/qa_utils/elbo_drift.py
  • utils/ram_monitor.py
  • utils/read_file.py
  • utils/umap_plotting/umap_plots.py

Tests Added

  • test_logs_metadata_dirs.py - Tests to verify the new directory structure

Fixes #308

@abuzarmahmood can click here to continue refining the PR

openhands-agent and others added 2 commits February 18, 2026 10:46
- Created logs/ directory for all log files:
  - output.log (Tee class)
  - results.log (blech_init.py)
  - ram_usage.log (ram_monitor.py)
  - blech_process.log (blech_process.py)
  - umap_results.log (umap_plots.py)
  - execution_log.json (pipeline_graph_check)

- Created metadata/ directory for all metadata files:
  - electrode_layout_frame.csv
  - trial_info_frame.csv
  - dig_in_frame.csv
  - *.info file
  - *.params file
  - aggregated_characteristics.csv
  - unit_descriptor.csv
  - unit_profile.csv
  - waveform_classifier_recommendations.csv

- Added backward compatibility to check old locations if files
  don't exist in new directories

- Added helper functions:
  - ensure_dir(data_dir, subdir)
  - get_metadata_dir(data_dir)
  - get_logs_dir(data_dir)
  - find_file_in_dir(data_dir, filename_pattern)

Co-authored-by: openhands <openhands@all-hands.dev>
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.

Put all logs in a logs directory in the data_dir

2 participants