msujas / pdfgetx3_gui

A gui for running PDFgetX3
MIT License
5 stars 1 forks source link

can't load xy / xye files that contain meta data in headers #4

Open till-schertenleib opened 6 days ago

till-schertenleib commented 6 days ago

I think the gui can only load xrd files that have no header lines. Many files exported from lab instruments or from anywhere else contain some metadata in the header, which is often quite useful to keep.

Thanks for this very useful tool!

Till

till-schertenleib commented 6 days ago

diffpy.utils is a useful package to handle different dataformats. It has a loadData() function which might be useful.

msujas commented 6 days ago

can you send me an example file so I can look into it?

msujas commented 6 days ago

is the metadata in your file marked with a '#'?

till-schertenleib commented 6 days ago

It looks like that:

[Diffraction_object] name = Absorption corrected input_data: SU101_40-1_BiMOF_500umSpezGlass_accum_0 wavelength = 0.71 scat_quantity = x-ray mud = 2.1792017503005123 anode_type = Mo wavelength = 0.71 output_directory = C:\Users\tills\PDF\bea\bimof\data\lab\su101_500umSpezGlass_corrected.xy xtype = tth method = polynomial_interpolation username = till email = till.schertenleib@gmail.com z_scan_file = C:\Users\tills\PDF\bea\bimof\data\lab\SU101_40-1_BiMOF_500um_spec_glass_exported.xy package_info = {'diffpy.labpdfproc': '0.2.0', 'diffpy.utils': '3.5.0'} input_directory = C:\Users\tills\PDF\bea\bimof\data\lab\SU101_40-1_BiMOF_500umSpezGlass_accum_0.xy creation_time = 2024-11-08 09:50:33.820075

start data

2.000099897384640002e+00 5.779828003216881598e+02 2.020537221804259875e+00 5.662578146175662823e+02 2.040974546223880193e+00 5.571583334011457964e+02

till-schertenleib commented 6 days ago

The start data has #### in front of it

till-schertenleib commented 6 days ago

if I mark all meta infromation with # it will work?

msujas commented 6 days ago

I've just used np.loadtxt(filename, unpack=True, comments='#'). So if every line of metadata starts with '#', including the axis names, it should work.

till-schertenleib commented 6 days ago

Oh okay I haven't realized that. Perfect then I'll just do that. thanks!

msujas commented 6 days ago

Do you have a lot of files? Will it be annoying to modify all of them?

till-schertenleib commented 6 days ago

It's not to annoying. It's for files that we get from lab instruments. Sometimes also from other beamlines. I could probably write a script that deals with that if I have a lot of files at some point.

However, if there is a simple way to modify your GUI, that would be super convenient. I will send you two example files via email.