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

test_dataimport.py and dataimport_example issues #67

Open
kernb2 opened this issue Apr 13, 2020 · 1 comment
Open

test_dataimport.py and dataimport_example issues #67

kernb2 opened this issue Apr 13, 2020 · 1 comment
Assignees

Comments

@kernb2
Copy link
Contributor

kernb2 commented Apr 13, 2020

Documentation Issues in the test_dataimport.py.
Testing in the test_dataimport.py

  • mostly just need to figure out how to test against the indexing error

In the dataimport_example
IndexError Traceback (most recent call last)
in
2 directory = '../ramandecompy/tests/test_files/'
3 # open hdf5 file as read/write
----> 4 dataimport.data_import(hdf5_filename,directory)
5 dataprep.view_hdf5(hdf5_filename+'.hdf5')

~\anaconda3\lib\site-packages\ramandecompy-1.0b0-py3.7.egg\ramandecompy\dataimport.py in data_import(hdf5_filename, directory)
45 if filename.startswith('FA_') and filename.endswith('.csv'):
46 locationandfile = directory + filename
---> 47 dataprep.add_experiment(str(hdf5_filename)+'.hdf5', locationandfile)
48 print('Data from {} fit with compound pseudo-Voigt model. Results saved to {}.'.format(filename, hdf5_filename))
49 # printing out to user the status of the import (because it can take a long time if importing a lot of data,

~\anaconda3\lib\site-packages\ramandecompy-1.0b0-py3.7.egg\ramandecompy\dataprep.py in add_experiment(hdf5_filename, exp_filename)
202 specs = specs.split('_')
203 time = specs[-1]
--> 204 temp = specs[-2]
205 # write data to .hdf5
206 exp_file['{}/{}/wavenumber'.format(temp, time)] = data['wavenumber']

IndexError: list index out of range

@kernb2 kernb2 changed the title dataimport.py issues test_dataimport.py and dataimport_example issues Apr 14, 2020
@kernb2
Copy link
Contributor Author

kernb2 commented Apr 26, 2020

The issue is a dataprep.addexperiment issue with indexing when the experimental file is formatted wrong like this FA_3.6wt%_400C_12.5s.csv' where the 12.5s with the period is throwing off the index.

Here is the index error
IndexError Traceback (most recent call last)
in
3 oldexphdf5 = h5py.File(hdf5_filename+'.hdf5', 'r+')
4 add_experiment('olddataprep_experiment.hdf5', '../ramandecompy/tests/test_files/FA_3.6wt%_300C_25s.csv')
----> 5 add_experiment('olddataprep_experiment.hdf5', '../ramandecompy/tests/test_files/FA_3.6wt%_400C_12.5s.csv')
6 # dataprep.add_experiment('olddataprep_experiment.hdf5', '../ramandecompy/tests/test_files/FA_3.6wt%_300C_45s.csv')

in add_experiment(hdf5_filename, exp_filename)
118 specs = specs.split('_')
119 time = specs[-1]
--> 120 temp = specs[-2]
121 # write data to .hdf5
122 exp_file['{}/{}/wavenumber'.format(temp, time)] = data['wavenumber']

IndexError: list index out of range

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

2 participants