all-umass / superman

MIT License
7 stars 6 forks source link

Error parsing wxd file #4

Open somerandomsequence opened 6 years ago

somerandomsequence commented 6 years ago

Hello again. Thanks for your help with those other issues. I'm getting much further, but still cannot seem to read a WXD file. I have installed metakit (.so and .py placed in scripts directory).

$ python scripts/convert_spectra.py -f rruff ~/somefile.wxd 
Traceback (most recent call last):
  File "scripts/convert_spectra.py", line 34, in <module>
    main()
  File "scripts/convert_spectra.py", line 26, in main
    for infile, traj in map(_parse, args.files):
  File "scripts/convert_spectra.py", line 8, in _parse
    return infile, parse_spectrum(infile)
  File "/home/cphillip/.local/lib/python2.7/site-packages/superman/file_io/__init__.py", line 176, in parse_spectrum
    return parse_loose(fileobj)
  File "/home/cphillip/.local/lib/python2.7/site-packages/superman/file_io/__init__.py", line 39, in parse_loose
    data = np.loadtxt(fh, dtype=np.float32, delimiter=',', usecols=(0,1))
  File "/home/cphillip/.local/lib/python2.7/site-packages/numpy/lib/npyio.py", line 1092, in loadtxt
    for x in read_data(_loadtxt_chunksize):
  File "/home/cphillip/.local/lib/python2.7/site-packages/numpy/lib/npyio.py", line 1012, in read_data
    vals = [vals[j] for j in usecols]
IndexError: list index out of range

Is this the correct usage for reading a Renishaw WXD and writing to some other format? I'm working with data from a Renishaw inVia Raman Microscope. I'll see if there's a file I can share to reproduce this issue.

perimosocordiae commented 6 years ago

Sorry for the belated reply. Your usage looks fine, so it's likely a shortfall in the WXD parser. If you dig up a shareable example I'll take a look.

In the mean time, you can try plot_spectra.py --type wxd ~/somefile.wxd and paste the error message it prints.