Skip to content

Latest commit

 

History

History
60 lines (43 loc) · 1.29 KB

File metadata and controls

60 lines (43 loc) · 1.29 KB

🔄 PRN to CSV Converter

This Python script batch-processes binary .PRN files and converts them into clean .CSV files for easier analysis.

🚀 Features

  • Reads binary .PRN files containing 32-bit floating-point values.
  • Drops initial 29 records (often metadata or calibration noise).
  • Outputs clean CSV files with a single Spectrum column.
  • Processes all .PRN files in a specified input directory.

📁 Folder Structure

inputprnswc/       # Put your .PRN files here  
outputcsvswc/      # CSVs will be saved here after conversion

🛠️ How It Works

  1. Reads binary data in 4-byte chunks (single float per chunk).
  2. Converts values into a list of dictionaries.
  3. Skips the first 29 entries.
  4. Writes the rest into a .csv using pandas.

✅ Usage

Just update the paths and run:

input_folder = r"inputprnswc"
output_folder = r"outputcsvswc"
process_all_prn_files(input_folder, output_folder)

📦 Dependencies

  • Python 3.6+
  • pandas
  • struct
  • os
  • pathlib

Install with:

pip install pandas

📊 Output Format

Each CSV will contain:

Spectrum
0.123456
0.654321
...

🪪 LICENSE

This project is under the Creative Commons Zero v1.0 Universal license.