{"id":8830,"date":"2024-08-01T11:49:32","date_gmt":"2024-08-01T18:49:32","guid":{"rendered":"https:\/\/www.hmc.edu\/chemistry\/?page_id=8830"},"modified":"2024-08-01T12:59:37","modified_gmt":"2024-08-01T19:59:37","slug":"alicia-hernandez-castillo-programs","status":"publish","type":"page","link":"https:\/\/www.hmc.edu\/chemistry\/alicia-hernandez-castillo-programs\/","title":{"rendered":"Alicia Hernandez-Castillo Programs"},"content":{"rendered":"\n<p>This program converts the line list from the log file from PGOPHER into an XIAM format.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>import csv<\/p>\n\n\n\n<p>file_path = input(&#8220;Input File Path: &#8220;)<br>output_file_name = input(&#8220;Output File Name: &#8220;)<\/p>\n\n\n\n<p>newCsvData = []<\/p>\n\n\n\n<p>with open(file_path, mode=&#8217;r&#8217;) as file:<br>csv_reader = csv.reader(file)<br>header_row = next(csv_reader)<br>header_row = next(csv_reader)<code>firstValIndex = header_row.index(\"Position\") secondValIndex = header_row.index(\"Intensity\") # go through csv rows and cols for row in csv_reader: try: newCsvData.append([row[firstValIndex], row[secondValIndex]]) except: pass<\/code><\/p>\n\n\n\n<p>with open(output_file_name, mode=&#8221;w&#8221;, newline=&#8221;) as file:<br>csv_writer = csv.writer(file)<br>csv_writer.writerows(newCsvData)<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This program converts the line list from the log file from PGOPHER into an XIAM format. import csv file_path = [&hellip;]<\/p>\n","protected":false},"author":51,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-8830","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.hmc.edu\/chemistry\/wp-json\/wp\/v2\/pages\/8830","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hmc.edu\/chemistry\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.hmc.edu\/chemistry\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.hmc.edu\/chemistry\/wp-json\/wp\/v2\/users\/51"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hmc.edu\/chemistry\/wp-json\/wp\/v2\/comments?post=8830"}],"version-history":[{"count":4,"href":"https:\/\/www.hmc.edu\/chemistry\/wp-json\/wp\/v2\/pages\/8830\/revisions"}],"predecessor-version":[{"id":8841,"href":"https:\/\/www.hmc.edu\/chemistry\/wp-json\/wp\/v2\/pages\/8830\/revisions\/8841"}],"wp:attachment":[{"href":"https:\/\/www.hmc.edu\/chemistry\/wp-json\/wp\/v2\/media?parent=8830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}