Processing jMRUI (publish all) HTML files, Python module

Hi jMRUI users,

I just completed a module in Python for processing the HTML files created by AMARES in jMRUI when saving the fit results for a series of spectra with the ‘publish all’ command.
I used panda tools in Python to interpret the HTML code and produce the output table as an Excel file.
The output of the module is an Excel file with one row per spectrum, and the peak amplitudes (plus some summed peaks amplitudes e.g. CH3+CH2 for IMCL or EMCL) and the SNR estimates.
This module can easily be customized to other types of spectra.

Sample output:

Processing HISTO_TE14TR3000TE014.html in folder /Users/…/HISTO_TE1420_1

Found CH3e in : 1 - CH3e - G with amplitude 6.487e-06 at freq 0.837
Found CH2 in : 3 - CH2i - G with amplitude 0.0002168 at freq 1.287
Found CH3i in : 2 - CH3i - G with amplitude 1.945e-06 at freq 0.940
Found CH2 in : 4 - CH2e - G with amplitude 0.001116 at freq 1.526
Found H2O in : 7 - H2Og - G with amplitude 0.003779 at freq 4.645
Found H2O in : 8 - L H2Ol with amplitude 0.0609 at freq 4.681
Found Cr in : 5 - Cr - G with amplitude 0.0002037 at freq 3.018
Found Cho in : 6 - Cho - G with amplitude 0.0002216 at freq 3.300
Total amplitude for IMCL = 0.00111794 and EMCL = 0.000223287
Total amplitude for water = 0.064679
…etc,
for each spectrum…
Found Cr in : 5 - Cr - G with amplitude 5.493e-05 at freq 3.006
Found Cho in : 6 - Cho - G with amplitude 2.918e-05 at freq 3.180
Total amplitude for IMCL = 0.0007829 and EMCL = 0.00019337
Total amplitude for water = 0.0089116

                                          File        CH3e       CH2e        ...  Cr            TMA          SNR

0 HISTO_TE14TR3000TE014.mrui 0.000006 0.000217 … 0.000204 0.000222 92.35
1 HISTO_TE14TR3000TE023.mrui 0.000043 0.000324 … 0.000117 0.000041 92.13
2 HISTO_TE14TR3000TE035.mrui 0.000000 0.000000 … 0.000000 0.000000 88.91
3 HISTO_TE14TR3000TE050.mrui 0.000019 0.000180 … 0.000064 0.000092 92.98
4 HISTO_TE14TR3000TE072.mrui 0.000032 0.000161 … 0.000055 0.000029 81.82
This last table will be saved as an Excel file.

Enjoy,

Ronald

read_mruihtml.py.zip (4.2 KB)

1 Like

Thanks Ron, I’m sure that’ll be useful to folks! Want me to add it to the MRSHub software collection?