本文整理匯總了Python中pychron.graph.graph.Graph.get_data方法的典型用法代碼示例。如果您正苦於以下問題:Python Graph.get_data方法的具體用法?Python Graph.get_data怎麽用?Python Graph.get_data使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pychron.graph.graph.Graph
的用法示例。
在下文中一共展示了Graph.get_data方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: cup_deflection_calibration
# 需要導入模塊: from pychron.graph.graph import Graph [as 別名]
# 或者: from pychron.graph.graph.Graph import get_data [as 別名]
def cup_deflection_calibration(self, mass):
self.info('{} deflection calibration'.format(self.reference_detector))
rgraph = RegressionGraph(window_x=100,
window_y=50)
rgraph.new_plot()
rgraph.new_series(yer=[])
root_dir = unique_dir(os.path.join(paths.data_dir, 'magfield'), '{}_def_calibration'.format(self.reference_detector))
# if not os.path.exists(root_dir):
# os.mkdir(root_dir)
dm = self.data_manager
p = os.path.join(root_dir, 'defl_vs_dac.csv')
deflection_frame_key = dm.new_frame(path=p)
dm.write_to_frame(['Deflection (V)', '40{} DAC'.format(self.reference_detector)],
frame_key=deflection_frame_key)
start = self.dc_start
stop = self.dc_stop
width = self.dc_step
nstep = (stop - start) / width + 1
npeak_centers = self.dc_npeak_centers
self.info('Deflection scan parameters start={}, stop={}, stepwidth={}, nstep={}'.format(start, stop, width, nstep))
self.info('Reference detector {}'.format(self.reference_detector))
self.info('Peak centers per step n={}'.format(npeak_centers))
for i, ni in enumerate(np.linspace(start, stop, nstep)):
if not self.isAlive():
break
self.info('Deflection step {} {} (V)'.format(i + 1, ni))
self._detectors[self.reference_detector].deflection = ni
ds = []
for n in range(npeak_centers):
if not self.isAlive():
break
self.info('Peak center ni = {}'.format(n + 1))
p = os.path.join(root_dir, 'peak_scan_{:02d}_{:02d}.csv'.format(int(ni), n))
dm.new_frame(path=p)
dm.write_to_frame(['DAC (V)', 'Intensity (fA)'])
graph = Graph(window_title='Peak Centering',
window_x=175 + i * 25 + n * 5,
window_y=25 + i * 25 + n * 5
)
self.peak_center(graph=graph,
update_mftable=True,
update_pos=False,
center_pos=mass
)
if self.isAlive():
# write scan to file
dm.write_to_frame(list(zip(graph.get_data(), graph.get_data(axis=1))))
if npeak_centers > 1:
if not self.simulation:
time.sleep(1)
if self.peak_center_results:
d = (ni, self.peak_center_results[0][1])
ds.append(self.peak_center_results[0][1])
dm.write_to_frame(list(d), frame_key=deflection_frame_key)
# write the centering results to the centering file
dm.write_to_frame([('#{}'.format(x), y) for x, y in zip(graph.get_data(series=1), graph.get_data(series=1, axis=1))])
if self.peak_center_results:
rgraph.add_datum((ni, np.mean(ds), np.std(ds)))
if i == 2:
invoke_in_main_thread(rgraph.edit_traits)
# delay so we can view graph momonetarily
if not self.simulation and self.isAlive():
time.sleep(2)
self.info('deflection calibration finished')