{"$id":"1","Name":"Imaging - Simple counts display","IsTested":false,"Script":"import datetime\nimport os\n\nsummed_data = []\nfor isotope in enabled_isotopes:\n temp_data = []\n for pixel in range(total_cycles):\n temp_data.append(cps[isotope, pixel])\n if summed_data == []:\n summed_data = temp_data\n else:\n summed_data = [temp1 + temp2 for temp1, temp2 in zip(summed_data, temp_data)]\n data.update_image(str(label[isotope])+\" [cps]\", temp_data)\n\ndata.update_image(\"sum [cps]\", summed_data)\n\n# export data\nif create_files > 0:\n dt = datetime.datetime(sample_timestamp) \n time_stamp = dt.isoformat()\n sample_dir = \"C:\\\\VitesseExport\\\\%s\\\\\" %(line.image_name)\n if not os.path.isdir(sample_dir): \n try:\n os.mkdir(sample_dir)\n print(\"Created the directory %s\" %(sample_dir))\n except:\n pass\n \n file_name2 = sample_dir + \"line_%.0f.csv\" %(line.number)\n with open(file_name2,\"w\") as f:\n if line.line_type == 0:\n direction_str = \"0,Left to Right\"\n elif line.line_type == 1:\n direction_str = \"1,Right to Left\"\n elif line.line_type == 2:\n direction_str = \"2,Top to Bottom\"\n else:\n direction_str = \"3,Bottom to Top\"\n labels = \"Timestamp:,{0}\\n Laser line number: ,{1} \\n Laser line name:, {2} \\n Laser image name:, {3} \\n Starting X:, {4} \\n Starting Y:,{5} \\n Starting Z:, {6} \\n Spot size:, {7} \\n Spot spacing:, {8} \\n Number of shots:, {9} \\n Direction of ablation:, {10} \\n Cycle time (ms),x [um],y [um]\" . format(time_stamp,str(line.number),str(line.name),str(line.image_name),str(line.start_x),str(line.start_y),str(line.start_z),str(line.spot_size),str(line.spot_spacing),str(line.num_spots),direction_str)\n \n for isotope in enabled_isotopes:\n labels += \",%s cps\" %(label[isotope])\n f.write(labels + \"\\n\")\n \n with open(file_name2,\"a\") as f:\n for cycle in range(total_cycles):\n if line.line_type == 0:\n temp_str = \"%s,%s,%s\" %(cycle_times[cycle],line.start_x + line.spot_size * cycle, line.start_y)\n elif line.line_type == 1:\n temp_str = \"%s,%s,%s\" %(cycle_times[cycle],line.start_x - line.spot_size * cycle, line.start_y)\n elif line.line_type == 2:\n temp_str = \"%s,%s,%s\" %(cycle_times[cycle],line.start_x, line.start_y + line.spot_size * cycle)\n else:\n temp_str = \"%s,%s,%s\" %(cycle_times[cycle],line.start_x, line.start_y - line.spot_size * cycle)\n \n for isotope in enabled_isotopes:\n temp_str += \",%f\" %(cps[isotope, cycle])\n f.write(temp_str + \"\\n\")\n","Version":1,"ParameterDefinitions":[{"Id":1,"Name":"create_files","ParamterType":0,"Label":"export","Tooltip":null,"DefaultValue":"0","DisplayOrder":0}]}