Dear community,
I encountered that Iolite v4 reads the laser log files of several instrument types. However, it does not retain an internal copy of the imported *.csv (although, it memorises the original file path).
I am contributing a script to export the preserved information of the laser log file into 'perserved_log-file.xlsx' sitting in the project's (*.io4) folder location.
'''
'paul_logFile.py'
Script to export laser log basic information that is preserved in Iolite v4
Documentation followed:
https://iolite.xyz/docs/api/api.html#iolite.IolitePythonInterface
https://doc.qt.io/qt-6/qdatetime.html
https://forum.iolite.xyz/d/77-synchronizing-individual-laser-log-samples/2
Notes: The parameters that were lost relative to an *.iolite.csv file (Agilent) are
'Comment, Spot Type, MFC1, MFC2, Cell Pressure, Fluence At Sample, ...'
Created: 21-Jul-25, Bence P., Marco A.
Updated:
'''
import os
import numpy as np
import pandas as pd
#User input
output_file = 'perserved_log-file.xlsx'
#Script
#Original imported file (retrieve if exist)
file_1 = data.importedLogs()[0].fileName()
print(file_1)
#Parse preserved log data
filePath = data.sessionFilePath() #iolite.IolitePythonInterface.
iolite_folder, iolite_file = os.path.split(filePath)
output_path = os.path.join(iolite_folder, output_file)
log_list = data.laserLogSamples()
content = []
for i, lls in enumerate(log_list):
a1 = i
a2 = lls.sampleName()
#.time() , .toMSecsSinceEpoch()/1000 ,
a3 = lls.startTime().toString("yyyy-MM-dd HH:mm:ss.zzz")
a4 = lls.endTime().toString("yyyy-MM-dd HH:mm:ss.zzz")
a5 = lls.start_x
a6 = lls.end_x
a7 = lls.start_y
a8 = lls.end_y
a9 = lls.spot_height
a10 = lls.spot_width
a11 = lls.spot_shape
a12 = lls.angle
a13 = lls.image_file
a14 = lls.rep_rate
a15 = lls.scan_speed
row = [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15]
content.append(row)
content1 = pd.DataFrame(content)
content1.columns = [
'id', 'sampleName', 'startTime', 'endTime',
'start_x', 'end_x', 'start_y', 'end_y',
'spot_height', 'spot_width', 'spot_shape', 'angle',
'image_file', 'rep_rate', 'scan_speed'] # Rename the columns
content2 = content1.sort_values(by='startTime', ascending=True)
content2.to_excel(output_path, index=False)
print(output_path) #search here
#print(content2.head())
Copy-paste this code into Iolite 4 > Python Workspace > and Run
Cordially,
Marco Acevedo