-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gui: fix an issue to blow up 0th bin in real-time mode display
- Loading branch information
Showing
8 changed files
with
8 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"eta_index_table":"[{\"id\":\"var_templatejgmgopco\",\"name\":\"file\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"C:/YourFolder/YourFile.timeres\"},{\"id\":\"var_templatejkim8l39\",\"name\":\"binsize\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"16\"},{\"id\":\"var_templatejkim8rzm\",\"name\":\"expname\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"Correlation\"},{\"id\":\"var_templatejkim8w21\",\"name\":\"bins\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"10000\"},{\"id\":\"var_templatek8g3kag4\",\"name\":\"delay\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"0\"},{\"id\":\"var_templatek8g498fo\",\"name\":\"bw_delay\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"0\"},{\"id\":\"var_templatek8g49hcs\",\"name\":\"fw_delay\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"0\"},{\"id\":\"dpp_templatek7r3sgz1\",\"name\":\"display\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"\"},{\"id\":\"dpp_templatek0e4ffxo\",\"name\":\"save txt\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"\"},{\"id\":\"vi_templatek6z7s4mo\",\"name\":\"quTAG\",\"group\":\"quTAG\",\"info\":\"📜[0, 1, 2, 3, 4, 5] \",\"config\":\"\"},{\"id\":\"vi_templatek0e3lgeo\",\"name\":\"DL1-6 (quTAG)\",\"group\":\"quTAG\",\"info\":\"📥[1] 📤[6] \",\"config\":\"\"},{\"id\":\"vi_templatek0e3lz43\",\"name\":\"DL2-7 (quTAG)\",\"group\":\"quTAG\",\"info\":\"📥[2] 📤[7] \",\"config\":\"\"},{\"id\":\"vi_templatek0e3qybt\",\"name\":\"backward correlation (quTAG)\",\"group\":\"quTAG\",\"info\":\"📥[7, 6] \",\"config\":\"\"},{\"id\":\"vi_templatek0e3sowi\",\"name\":\"forward correlation (quTAG)\",\"group\":\"quTAG\",\"info\":\"📥[6, 7] \",\"config\":\"\"}]","var_templatejgmgopco":null,"var_templatejkim8l39":null,"var_templatejkim8rzm":null,"var_templatejkim8w21":null,"vi_templatek0e3lgeo":"{\"nodes\":[{\"x\":121,\"y\":114,\"fixed\":true,\"text\":\"a\",\"initial\":true,\"px\":121,\"py\":114}],\"edges\":[{\"source\":0,\"target\":0,\"text\":\"1\"}],\"usercode\":\"a:\\n emit(6,`fw_delay`)\"}","vi_templatek0e3lz43":"{\"nodes\":[{\"x\":89,\"y\":107,\"fixed\":true,\"initial\":true,\"text\":\"a\"}],\"edges\":[{\"source\":0,\"target\":0,\"text\":\"2\"}],\"usercode\":\"a:\\n emit(7,`bw_delay`)\"}","vi_templatek0e3qybt":"{\"nodes\":[{\"x\":346,\"y\":111,\"fixed\":true,\"text\":\"start\",\"px\":346,\"py\":111},{\"x\":75,\"y\":86,\"fixed\":true,\"text\":\"stop\",\"px\":75,\"py\":86,\"initial\":true}],\"edges\":[{\"source\":0,\"target\":1,\"text\":\"7\"},{\"source\":1,\"target\":0,\"text\":\"6\"},{\"source\":0,\"target\":0,\"text\":\"6\"},{\"source\":1,\"target\":1,\"text\":\"7\"}],\"usercode\":\"HISTOGRAM(h4,(`bins`,`binsize`))\\nHISTOGRAM(h4_zero,(1,1))\\nCLOCK(c4,100,1)\\nstart:\\n c4.start()\\nstop:\\n c4.stop()\\n h4.record_all(c4)\\n h4_zero.record_all(c4)\"}","vi_templatek0e3sowi":"{\"nodes\":[{\"x\":346,\"y\":111,\"fixed\":true,\"text\":\"start\",\"px\":346,\"py\":111},{\"x\":76,\"y\":88,\"fixed\":true,\"text\":\"stop\",\"px\":76,\"py\":88,\"initial\":true}],\"edges\":[{\"source\":0,\"target\":1,\"text\":\"6\"},{\"source\":1,\"target\":0,\"text\":\"7\"},{\"source\":0,\"target\":0,\"text\":\"7\"},{\"source\":1,\"target\":1,\"text\":\"6\"}],\"usercode\":\"HISTOGRAM(h3,(`bins`,`binsize`))\\nCLOCK(c3,100,1)\\nstart:\\n c3.start()\\nstop:\\n c3.stop()\\n h3.record_all(c3)\"}","dpp_templatek0e4ffxo":"#------IMPORTS-----\r\nfrom pathlib import Path\r\nimport numpy as np\r\n\r\ndef get_files(extensions):\r\n global path\r\n all_files = []\r\n for ext in extensions:\r\n all_files.extend(path.glob(ext))\r\n return all_files\r\n \r\ndef info(filename, binsize=binsize, bins=bins):\r\n return (f'Created with ETA - https://timetag.github.io\\n'\r\n f'filename: {filename.name}\\n'\r\n f'binsize: {binsize}\\n'\r\n f'bins: {bins}\\n'\r\n )\r\n\r\n#------ADJUST DELAY-----\r\ndelay = int(float(delay))\r\neta.recipe.set_parameter(\"bw_delay\",str(max(0,-1*delay)))\r\neta.recipe.set_parameter(\"fw_delay\",str(max(0,delay)))\r\neta.load_recipe()\r\n\r\n#------ETA PROCESSING-----\r\nbinsize=int(float(binsize))\r\npath = Path(file)\r\ndatafolder='analyzed data'\r\n\r\nselector = (f for f in get_files(('*.ptu','*.timeres'))) if path.is_dir() else [path]\r\n\r\nfor f in selector:\r\n cutfile = eta.clips(f)\r\n result=eta.run({\"timetagger1\":cutfile}, group='quTAG')\r\n hist1=result[\"h3\"]\r\n hist2=result[\"h4\"]\r\n hist0=result[\"h4_zero\"]\r\n hist1[0]+= hist0[0]\r\n fullhist=np.concatenate((hist2[::-1],hist1))\r\n f.parent.joinpath(datafolder).mkdir(parents=True, exist_ok=True)\r\n np.savetxt(f.parent.joinpath(datafolder, f.stem + '_correlation' + '.txt'), np.transpose([np.arange(-hist2.size,hist1.size)*binsize,fullhist]), delimiter='\\t', header=info(f))\r\n eta.send(str(f.name) + ' has been successfully processed')\r\neta.send('FINISHED')\r\n\r\n","vi_templatek6z7s4mo":"{\"nodes\":[{\"x\":192,\"y\":157,\"fixed\":true,\"initial\":true}],\"edges\":[],\"usercode\":\"\\n########## click Help on the menu to get started! ##########\\nRFILE(timetagger1,[0,1,2,3,4,5])\"}","dpp_templatek7r3sgz1":"# Unfortunately no realtime recipe for quTAG, as the file is not written by\n# the control software until the experiment is stopped.\n#------IMPORTS-----\n\nimport numpy as np\nimport pandas as pd\nfrom pathlib import Path\n\nimport etabackend.tk.plot as etaplt\nimport etabackend.tk.utils as etautils\n\n#------ADJUST DELAY-----\ndelay = int(float(delay))\neta.recipe.set_parameter(\"bw_delay\",str(max(0,-1*delay)))\neta.recipe.set_parameter(\"fw_delay\",str(max(0,delay)))\neta.load_recipe()\n\n#------ETA PROCESSING-----\ncut=eta.clips(Path(file))\nresult= eta.run({\"timetagger1\":cut}, group='quTAG')\nhist1=result[\"h3\"]\nhist2=result[\"h4\"]\nhist0=result[\"h4_zero\"]\nhist1[0]+= hist0[0]\n\nfullhist=np.concatenate((hist2[::-1],hist1))\nxdata = np.arange(-hist2.size,hist1.size)*int(float(binsize))\n\nf=Path(file)\nDATAFOLDER = 'analyzed data'\nLABEL = expname\n#------PLOTTING-----\n\ndf = pd.DataFrame(np.vstack((xdata, fullhist)).T, \n columns=['time bins', 'histogram events'])\ndf['log events'] = np.clip(df['histogram events'].values, 0.5, None)\n\ndef generate_doc(doc):\n root = etaplt.plot_histogram(df, f, f.parent.joinpath(DATAFOLDER), \n data_name=LABEL.capitalize(), file_label=LABEL.lower(), \n info=etautils.info(globals_dict=eta.compilecache_vars['quTAG'], recipe_type=LABEL))\n doc.add_root(root)\n return doc\n\neta.display(generate_doc, 'bokeh')\n","var_templatek8g3kag4":null,"var_templatek8g498fo":null,"var_templatek8g49hcs":null} | ||
{"eta_index_table":"[{\"id\":\"var_templatejgmgopco\",\"name\":\"file\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"C:/YourFolder/YourFile.timeres\"},{\"id\":\"var_templatejkim8l39\",\"name\":\"binsize\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"16\"},{\"id\":\"var_templatejkim8rzm\",\"name\":\"expname\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"Correlation\"},{\"id\":\"var_templatejkim8w21\",\"name\":\"bins\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"10000\"},{\"id\":\"var_templatek8g3kag4\",\"name\":\"delay\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"0\"},{\"id\":\"var_templatek8g498fo\",\"name\":\"bw_delay\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"0\"},{\"id\":\"var_templatek8g49hcs\",\"name\":\"fw_delay\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"0\"},{\"id\":\"dpp_templatek7r3sgz1\",\"name\":\"display\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"\"},{\"id\":\"dpp_templatek0e4ffxo\",\"name\":\"save txt\",\"group\":\"quTAG\",\"info\":\"\",\"config\":\"\"},{\"id\":\"vi_templatek6z7s4mo\",\"name\":\"quTAG\",\"group\":\"quTAG\",\"info\":\"📜[0, 1, 2, 3, 4, 5] \",\"config\":\"\"},{\"id\":\"vi_templatek0e3lgeo\",\"name\":\"DL1-6 (quTAG)\",\"group\":\"quTAG\",\"info\":\"📥[1] 📤[6] \",\"config\":\"\"},{\"id\":\"vi_templatek0e3lz43\",\"name\":\"DL2-7 (quTAG)\",\"group\":\"quTAG\",\"info\":\"📥[2] 📤[7] \",\"config\":\"\"},{\"id\":\"vi_templatek0e3qybt\",\"name\":\"backward correlation (quTAG)\",\"group\":\"quTAG\",\"info\":\"📥[7, 6] \",\"config\":\"\"},{\"id\":\"vi_templatek0e3sowi\",\"name\":\"forward correlation (quTAG)\",\"group\":\"quTAG\",\"info\":\"📥[6, 7] \",\"config\":\"\"}]","var_templatejgmgopco":null,"var_templatejkim8l39":null,"var_templatejkim8rzm":null,"var_templatejkim8w21":null,"vi_templatek0e3lgeo":"{\"nodes\":[{\"x\":121,\"y\":114,\"fixed\":true,\"text\":\"a\",\"initial\":true,\"px\":121,\"py\":114}],\"edges\":[{\"source\":0,\"target\":0,\"text\":\"1\"}],\"usercode\":\"a:\\n emit(6,`fw_delay`)\"}","vi_templatek0e3lz43":"{\"nodes\":[{\"x\":89,\"y\":107,\"fixed\":true,\"initial\":true,\"text\":\"a\"}],\"edges\":[{\"source\":0,\"target\":0,\"text\":\"2\"}],\"usercode\":\"a:\\n emit(7,`bw_delay`)\"}","vi_templatek0e3qybt":"{\"nodes\":[{\"x\":346,\"y\":111,\"fixed\":true,\"text\":\"start\",\"px\":346,\"py\":111},{\"x\":75,\"y\":86,\"fixed\":true,\"text\":\"stop\",\"px\":75,\"py\":86,\"initial\":true}],\"edges\":[{\"source\":0,\"target\":1,\"text\":\"7\"},{\"source\":1,\"target\":0,\"text\":\"6\"},{\"source\":0,\"target\":0,\"text\":\"6\"},{\"source\":1,\"target\":1,\"text\":\"7\"}],\"usercode\":\"HISTOGRAM(h4,(`bins`,`binsize`))\\nHISTOGRAM(h4_zero,(1,1))\\nCLOCK(c4,100,1)\\nstart:\\n c4.start()\\nstop:\\n c4.stop()\\n h4.record_all(c4)\\n h4_zero.record_all(c4)\"}","vi_templatek0e3sowi":"{\"nodes\":[{\"x\":346,\"y\":111,\"fixed\":true,\"text\":\"start\",\"px\":346,\"py\":111},{\"x\":76,\"y\":88,\"fixed\":true,\"text\":\"stop\",\"px\":76,\"py\":88,\"initial\":true}],\"edges\":[{\"source\":0,\"target\":1,\"text\":\"6\"},{\"source\":1,\"target\":0,\"text\":\"7\"},{\"source\":0,\"target\":0,\"text\":\"7\"},{\"source\":1,\"target\":1,\"text\":\"6\"}],\"usercode\":\"HISTOGRAM(h3,(`bins`,`binsize`))\\nCLOCK(c3,100,1)\\nstart:\\n c3.start()\\nstop:\\n c3.stop()\\n h3.record_all(c3)\"}","dpp_templatek0e4ffxo":"#------IMPORTS-----\r\nfrom pathlib import Path\r\nimport numpy as np\r\n\r\ndef get_files(extensions):\r\n global path\r\n all_files = []\r\n for ext in extensions:\r\n all_files.extend(path.glob(ext))\r\n return all_files\r\n \r\ndef info(filename, binsize=binsize, bins=bins):\r\n return ('Created with ETA - https://timetag.github.io\\n'+'filename: {}\\n'.format(filename.name) +'binsize: {}\\n'.format(binsize) +'bins: {}\\n'.format(bins) +'mode: {}\\n'.format(HH400_mode if \"HH400_mode\" in globals() else \"qutag\") )\r\n\r\n\r\n\r\n#------ADJUST DELAY-----\r\ndelay = int(float(delay))\r\neta.recipe.set_parameter(\"bw_delay\",str(max(0,-1*delay)))\r\neta.recipe.set_parameter(\"fw_delay\",str(max(0,delay)))\r\neta.load_recipe()\r\n\r\n#------ETA PROCESSING-----\r\nbinsize=int(float(binsize))\r\npath = Path(file)\r\ndatafolder='analyzed data'\r\n\r\nselector = (f for f in get_files(('*.ptu','*.timeres'))) if path.is_dir() else [path]\r\n\r\nfor f in selector:\r\n cutfile = eta.clips(f)\r\n result=eta.run({\"timetagger1\":cutfile}, group='quTAG')\r\n hist1=result[\"h3\"]\r\n hist2=result[\"h4\"]\r\n hist0=result[\"h4_zero\"]\r\n hist1[0]+=hist0[0]\r\n hist0[0]=0\r\n fullhist=np.concatenate((hist2[::-1],hist1))\r\n f.parent.joinpath(datafolder).mkdir(parents=True, exist_ok=True)\r\n np.savetxt(f.parent.joinpath(datafolder, f.stem + '_correlation' + '.txt'), np.transpose([np.arange(-hist2.size,hist1.size)*binsize,fullhist]), delimiter='\\t', header=info(f))\r\n eta.send(str(f.name) + ' has been successfully processed')\r\neta.send('FINISHED')\r\n\r\n","vi_templatek6z7s4mo":"{\"nodes\":[{\"x\":192,\"y\":157,\"fixed\":true,\"initial\":true}],\"edges\":[],\"usercode\":\"\\n########## click Help on the menu to get started! ##########\\nRFILE(timetagger1,[0,1,2,3,4,5])\"}","dpp_templatek7r3sgz1":"# Unfortunately no realtime recipe for quTAG, as the file is not written by\n# the control software until the experiment is stopped.\n#------IMPORTS-----\n\nimport numpy as np\nimport pandas as pd\nfrom pathlib import Path\n\nimport etabackend.tk.plot as etaplt\nimport etabackend.tk.utils as etautils\n\n#------ADJUST DELAY-----\ndelay = int(float(delay))\neta.recipe.set_parameter(\"bw_delay\",str(max(0,-1*delay)))\neta.recipe.set_parameter(\"fw_delay\",str(max(0,delay)))\neta.load_recipe()\n\n#------ETA PROCESSING-----\ncut=eta.clips(Path(file))\nresult= eta.run({\"timetagger1\":cut}, group='quTAG')\nhist1=result[\"h3\"]\nhist2=result[\"h4\"]\nhist0=result[\"h4_zero\"]\nhist1[0]+= hist0[0]\n\nfullhist=np.concatenate((hist2[::-1],hist1))\nxdata = np.arange(-hist2.size,hist1.size)*int(float(binsize))\n\nf=Path(file)\nDATAFOLDER = 'analyzed data'\nLABEL = expname\n#------PLOTTING-----\n\ndf = pd.DataFrame(np.vstack((xdata, fullhist)).T, \n columns=['time bins', 'histogram events'])\ndf['log events'] = np.clip(df['histogram events'].values, 0.5, None)\n\ndef generate_doc(doc):\n root = etaplt.plot_histogram(df, f, f.parent.joinpath(DATAFOLDER), \n data_name=LABEL.capitalize(), file_label=LABEL.lower(), \n info=etautils.info(globals_dict=eta.compilecache_vars['quTAG'], recipe_type=LABEL))\n doc.add_root(root)\n return doc\n\neta.display(generate_doc, 'bokeh')\n","var_templatek8g3kag4":null,"var_templatek8g498fo":null,"var_templatek8g49hcs":null} |
Oops, something went wrong.