Hi HoseongLim ,
Your importer is almost there! It's just the line
f=data.createImportedFileMetadata( ... , names_list)
Although you've dropped these columns from the dataframe, the list names_list
is still the same as you assigned on Line 80:
names_list = ['Li7', 'Mg25', 'Al27', 'Si29', 'S34', 'Sr88', 'Y89', 'U238', 'Measurement', 'Time', 'ID']
The line f=data.createImportedFileMetadata(...)
creates a File listing to go in iolite's Files Browser. When you create this File, you tell iolite what channels were in the File. You should only use the Li7 -> U238 values (i.e. drop 'Measurement', 'Time' and 'ID' from that list). Otherwise, iolite will think that there's a channel somewhere called 'Time', and that will cause errors.
You could remove these from the names_list by calling
names_list.remove('Time')
names_list.remove('ID')
names_list.remove('Measurement')
just before calling that data.createImportedFileMetadata()
line. You can see more about deleting list items here:
https://www.w3schools.com/python/gloss_python_remove_list_items.asp
Also, just a couple of things to polish:
You manually remove the message at the bottom of the file. You can avoid this by passing a non-zero value to pd.read_csv(..., skipfooter=footer_lines, ...)
. See here for more info (in particular the skipfooter
section).
Also, even though your importer works perfectly for the given file, a challenge you could set yourself is: what if the channels measured changed from file to file? Could you find and read the line that tells you what channels were measured? Similarly, the Settings recorded within the file are likely to change from file to file, so you don't want to hardwire (i.e. type out exactly) what they'll be. You could search for the line starting with "Settings", and then process that as metadata for your file.
Anyway, it seems like you're very close. With some of those pointers above, you should be well on your way.
If you have any other questions please let us know.
-Bence