I'm reaching out for help with parsing data from some "legacy equipment" in our lab. Specifically, I'm trying to read in the data-format *.ch from an Agilent HPLC (high pressure liquid chromatograph), which should contain some time values on the x-axis and some intensity values on the y-axis. However, I'm unable to intelligibly open these *.ch files. When I open them in notepad++, I see a garbled mess, and I've tried switching the encoding from notepad++'s encoding menu, but that didn't help. I've found a promising lead on this website: https://github.com/CINF/PyExpLabSys/blob/master/PyExpLabSys/file_parsers/chemstation.py. They've programmed a class called CHFile, which should read in exactly my file type. I tried it out, but it raises an error at: if version not in self.supported_versions: raise ValueError('Unsupported file version {}'.format(version)) I figure, let's just comment it out and see how far I get. The class reads in the file; however, there are problems. The metadata dictionary contains mostly correct entries: {'magic_number_version': 130, 'sequence_line_or_injection': 3, 'injection_or_sequence_line': 1, 'start_time': 0.0, 'end_time': 8.4075081907585965e-44, 'version_string': '130', 'description': 'LC DATA FILE', ...}. The only thing incorrect is the end-time. The class "values" variable should contain y data; however, it's mostly just very high or very low numerical values: [-2.66879447e+152 -2.55995935e+205 -2.56340917e+205 ... -1.94787226e+287 -2.45525828e+258 1.36350879e-311] So, my question is: how would I go about fixing this? How can I somehow extract information from the *.ch file? Should I be using a hex-editor? I have no idea how this works. How would I even begin looking for my y-values? Or maybe this is an encoding error? I understand the class CHFile() tries to open the *.ch file as a utf16 file. It does so via def parse_utf16_string(file_, encoding='UTF16'): """Parse a pascal type UTF16 encoded string from a binary file object""" # First read the expected number of CHARACTERS string_length = unpack(UINT8, file_.read(1))[0] # Then read and decode parsed = unpack(STRING.format(2 * string_length), file_.read(2 * string_length)) return parsed[0].decode(encoding) I don't fully understand what's going on here, but would it be worthwhile trying to read in as maybe utf32? I've tried to change the number 2 here to 4 (and also 1) just to see what happens. In all cases other than "2", I receive the error "truncated data remains". So clearly this must be more involved. Any suggestions on how to tackle this problem are greatly appreciated. Thank you! Of course, if anyone knows an already existing method for reading in Agilent Version 130 *.ch files, I'm all ears. Continue reading...