The Python version of ASCIItoTable is intended to be a more user- and software-friendly update to the original script written in Excel 2010's VBA. An improvement was deemed necessary as a result of regular software updates and new versions of the Microsoft Office suite causing bugs in the original script that could only be resolved with tedious code adjustments and/or toggling of specific references in the IDE. The original version also did not allow for easy accessibility on unix-based operating systems such as Mac OS or Linux. Python was ultimately chosen for its popularity and ubiquity and its simple portability between operating systems as well as the ease-of-use of its I/O and string manipulation capabilities, especially with the desired inputs and outputs being merely text files.
The original purpose is to resolve a bug in the LabSolutions software of Shimadzu's HPLC that would cause the system to output incorrect data in the more readable, tabular format but correct data in the raw ASCII files when using bracketed standards. Therefore, this script receives as input the ASCII files containing the correct data and outputs a single text file containing all of the samples, elutants, and their concentrations in a table.
This version is meant to be significantly simpler to use in that it will inquire of the user two inputs:
- Where are the ASCII files?
- Where do you want the results?
More specifically, the user should provide for both inputs the complete path of the respective folder. For the input folder, this folder should contain only ASCII data files that are to be processed into a single output file. The output folder can be the same as the input folder, if the user so wishes. However, the path to an existing file should not be given. The script creates the produced text file automatically with the name "results.txt" within the folder specified by the user.
Note: since the I/O function is in "write" mode, if any file named "results.txt" already exists within the folder specified, it will be overwritten with the new data.*
Finally, much of the portability of this script in terms of I/O depends on a Python package called pathlib. Testing it on two different versions of Python, it was found that common Python I/O operations such as listdir() or open() did not function properly with the path objects generated by pathlib in 3.5.4 but threw no errors in 3.6.2. If an earlier build of Python is absolutely necessary, one workaround is to convert the path objects to str types when being used in regular I/O functions.
Tommy Thompson - 10/17/18