Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting raw files from version imc STUDIO 2022 R3 (03.10.2022) not working #21

Open
Danarrow opened this issue Apr 3, 2023 · 2 comments

Comments

@Danarrow
Copy link

Danarrow commented Apr 3, 2023

  • Updating IMCtermite to V2.0.7
  • Converting raw-file with version imc STUDIO 5.2 R22 (28.07.2021) works fine.
  • Converting raw-file with version imc STUDIO 2022 R3 (03.10.2022) does not work.

Error:
Exception: failed to load/parse raw-file: invalid block or corrupt buffer at byte: 11

Kind regards

@mario-fink
Copy link
Collaborator

mario-fink commented Apr 4, 2023

@Danarrow Can you please share an example (or at least a representative section) of the problematic raw-file?

@pavijovi3
Copy link

Hi,

I am getting the same error when trying to convert .RAW file to .CSV file.
I am new to python coding so couldn't figure out myself.
here is the .raw file https://drive.google.com/file/d/1Mq-rWilk7zJVfb14cZh6yzjvylcVbRP5/view?usp=sharing

here is the code:
import IMCtermite
import os

def convert_raw_to_csv(folder_path):
# Get the list of .raw files in the folder
raw_files = [file for file in os.listdir(folder_path) if file.lower().endswith('.raw')]

for raw_file in raw_files:
    raw_file_path = os.path.join(folder_path, raw_file)
    csv_file_name = os.path.splitext(raw_file)[0] + '.csv'
    csv_file_path = os.path.join(folder_path, 'converted', csv_file_name)

    # Create the 'converted' subfolder if it doesn't exist
    os.makedirs(os.path.join(folder_path, 'converted'), exist_ok=True)

    # Convert the .raw file to .csv
    try:
        imcraw = IMCtermite.imctermite(raw_file_path.encode())
        imcraw.print_table(csv_file_path.encode())
        print(f"Conversion successful: {raw_file} -> {csv_file_name}")
    except RuntimeError as e:
        print(f"Conversion failed for {raw_file}: {e}")

print("Conversion process completed.")

Test the function with a folder path

folder_path = input("Enter the folder path containing .raw files: ")
convert_raw_to_csv(folder_path)

any advice would be helpful.

Thanks
Pavi.

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

No branches or pull requests

3 participants