Closed OmarAshkar closed 4 months ago
Could I suggest the following instead:
def parse_compound_names(path):
path = os.path.join(path, '_FUNC001.CMP')
dts = np.dtype([('compounds', 'S256'), ('transition', 'S256'), ('source', 'S512')])
dtu = np.dtype([('compounds', 'U256'), ('transition', 'U256'), ('source', 'U512')])
df = pd.DataFrame(np.fromfile(path, dtype=dts, offset=12).astype(dtu))
df['measurements'] = df['compounds'] + ' ' + (df.index.values + 1).astype(str)
return df
Could I suggest the following instead:
def parse_compound_names(path): path = os.path.join(path, '_FUNC001.CMP') dts = np.dtype([('compounds', 'S256'), ('transition', 'S256'), ('source', 'S512')]) dtu = np.dtype([('compounds', 'U256'), ('transition', 'U256'), ('source', 'U512')]) df = pd.DataFrame(np.fromfile(path, dtype=dts, offset=12).astype(dtu)) df['measurements'] = df['compounds'] + ' ' + (df.index.values + 1).astype(str) return df
wow! that is very neat! I'd appreciate if you contribute it in this PR. Another thing to be added is the daughter transition. However, I am not sure if it's there in this file though.
Indeed! my code is so bad in comparison :)
This one is related to #16.