• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python core.Script类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pylabcontrol.core.Script的典型用法代码示例。如果您正苦于以下问题:Python Script类的具体用法?Python Script怎么用?Python Script使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Script类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, name=None, settings=None, log_function = None, data_path = None):
     """
     Example of a script
     Args:
         name (optional): name of script, if empty same as class name
         settings (optional): settings for this script, if empty same as default settings
     """
     Script.__init__(self, name, settings, log_function= log_function, data_path = data_path)
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:8,代码来源:test_script.py


示例2: __init__

 def __init__(self, instruments = None, scripts = None, name = None, settings = None, log_function = None, data_path = None):
     """
     Example of a script that emits a QT signal for the gui
     Args:
         name (optional): name of script, if empty same as class name
         settings (optional): settings for this script, if empty same as default settings
     """
     Script.__init__(self, name, settings = settings, instruments = instruments, scripts = scripts, log_function= log_function, data_path = data_path)
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:8,代码来源:set_magnetic_coils.py


示例3: __init__

    def __init__(self, instruments, scripts=None, name=None, settings=None, log_function=None, data_path=None):
        """
        init script function see superclass for details on the parameters
        """
        Script.__init__(self, name, settings=settings, scripts=scripts, instruments=instruments,
                        log_function=log_function, data_path=data_path)

        self.data = None
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:8,代码来源:read_temperature_lakeshore.py


示例4: __init__

 def __init__(self, scripts, instruments = None, name = None, settings = None, log_function = None, data_path = None):
     """
     Initializes the script
     Args:
         name (optional): name of script, if empty same as class name
         settings (optional): settings for this script, if empty same as default settings
     """
     self.scan_label = 'Motor Position [um]'
     Script.__init__(self, name, settings, instruments, scripts, log_function= log_function, data_path = data_path)
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:9,代码来源:autofocus.py


示例5: __init__

 def __init__(self, instruments, scripts = None, name=None, settings=None, log_function=None, data_path = None):
     Script.__init__(self, name, settings=settings, scripts=scripts, instruments=instruments, log_function=log_function, data_path = data_path)
     # defines which daqs contain the input and output based on user selection of daq interface
     if self.settings['daq_type'] == 'PCI':
         self.daq_in = self.instruments['NI6259']['instance']
         self.daq_out = self.instruments['NI6259']['instance']
     elif self.settings['daq_type'] == 'cDAQ':
         self.daq_in = self.instruments['NI9402']['instance']
         self.daq_out = self.instruments['NI9263']['instance']
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:9,代码来源:esr_dithering.py


示例6: __init__

 def __init__(self, instruments = None, scripts = None, name = None, settings = None, log_function = None, data_path = None):
     """
     Sets up script and sends width and height settings to camera
     Args:
         name (optional): name of script, if empty same as class name
         settings (optional): settings for this script, if empty same as default settings
     """
     Script.__init__(self, name, settings = settings, instruments = instruments, scripts = scripts, log_function= log_function, data_path = data_path)
     self.instruments['Camera']['instance'].update({'width': self.settings['width'], 'height': self.settings['height']})
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:9,代码来源:take_image_camera.py


示例7: __init__

    def __init__(self, scripts, name = None, settings = None, log_function = None, timeout = 1000000000, data_path = None):
        self._recording = False
        self._timeout = timeout

        Script.__init__(self, name, settings, scripts = scripts, log_function= log_function, data_path = data_path)

        self.data = deque()

        self._sweep_values =  list({'frequency' : [], 'x' : [], 'y' : [], 'phase': [], 'r':[]}.keys())
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:9,代码来源:zi_high_res_sweep.py


示例8: __init__

    def __init__(self, instruments = None, name = None, settings = None, scripts = None, log_function = None, data_path = None):
        """
        Example of a script that emits a QT signal for the gui
        Args:
            name (optional): name of script, if empty same as class name
            settings (optional): settings for this script, if empty same as default settings
        """
        Script.__init__(self, name, settings = settings, instruments = instruments, scripts = scripts, log_function= log_function, data_path = data_path)

        self.data = {'baseline_image': [], 'new_image': [], 'image_extent': [], 'correlation_image': []}
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:10,代码来源:correlate_images.py


示例9: __init__

    def __init__(self, instruments, scripts=None, name=None, settings=None, log_function=None, data_path=None):
        """
        Example of a script that emits a QT signal for the gui
        Args:
            name (optional): name of script, if empty same as class name
            settings (optional): settings for this script, if empty same as default settings
        """
        Script.__init__(self, name, settings=settings, scripts=scripts, instruments=instruments,
                        log_function=log_function, data_path=data_path)

        self.data = {'counts': deque(), 'laser_power': deque(), 'normalized_counts': deque(), 'laser_power2': deque()}
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:11,代码来源:daq_read_counter.py


示例10: __init__

    def __init__(self, instruments, name = None, settings = None, log_function = None, data_path = None):
        """
        Example of a script that makes use of an instrument
        Args:
            instruments: instruments the script will make use of
            name (optional): name of script, if empty same as class name
            settings (optional): settings for this script, if empty same as default settings
        """

        # call init of superclass
        Script.__init__(self, name, settings, instruments, log_function= log_function, data_path = data_path)
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:11,代码来源:light_control.py


示例11: __init__

    def __init__(self, instruments, scripts, name=None, settings=None, log_function=None, data_path=None):
        """
        Standard script initialization
        Args:
            name (optional): name of script, if empty same as class name
            settings (optional): settings for this script, if empty same as default settings
        """
        self._DEFAULT_SETTINGS += PulsedExperimentBaseScript._DEFAULT_SETTINGS

        Script.__init__(self, name, settings=settings, scripts=scripts, instruments=instruments,
                        log_function=log_function, data_path=data_path)
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:11,代码来源:pulsed_experiment_base_script.py


示例12: __init__

    def __init__(self, instruments, scripts=None, name=None, settings=None, log_function=None, data_path=None):
        """
        Example of a script that emits a QT signal for the gui
        Args:
            name (optional): name of script, if empty same as class name
            settings (optional): settings for this script, if empty same as default settings
        """
        Script.__init__(self, name, settings=settings, scripts=scripts, instruments=instruments,
                        log_function=log_function, data_path=data_path)

        self.data_to_plot = {'voltage': deque(maxlen = self.settings['max_len_to_plot'])}
        self.data['voltage'] = list()
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:12,代码来源:daq_read_ai.py


示例13: __init__

 def __init__(self, instruments = None, scripts = None, name = None, settings = None, log_function = None, data_path = None):
     """
     Example of a script that emits a QT signal for the gui
     Args:
         name (optional): name of script, if empty same as class name
         settings (optional): settings for this script, if empty same as default settings
     """
     Script.__init__(self, name, settings = settings, instruments = instruments, scripts = scripts, log_function= log_function, data_path = data_path)
     if self.settings['daq_type'] == 'PCI':
         self.daq_out = self.instruments['NI6259_laser_power']['instance']
     elif self.settings['daq_type'] == 'cDAQ':
         self.daq_out = self.instruments['NI9263_laser_power']['instance']
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:12,代码来源:set_laser_power.py


示例14: __init__

    def __init__(self, scripts, name=None, settings=None, log_function=None, data_path=None):
        '''
        Initializes GalvoScan script for use in gui

        Args:
            instruments: list of instrument objects
            name: name to give to instantiated script object
            settings: dictionary of new settings to pass in to override defaults
            log_function: log function passed from the gui to direct log calls to the gui log
            data_path: path to save data

        '''
        self._DEFAULT_SETTINGS = self._DEFAULT_SETTINGS + GalvoScanGeneric._DEFAULT_SETTINGS
        Script.__init__(self, name, settings=settings, scripts=scripts, log_function=log_function, data_path = data_path)
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:14,代码来源:galvo_scan_osci.py


示例15: __init__

    def __init__(self, instruments, name = None, settings = None, log_function = None, timeout = 1000000000, data_path = None):

        self._recording = False
        self._timeout = timeout

        Script.__init__(self, name, settings, instruments, log_function= log_function, data_path = data_path)

        self.sweeper = self.instruments['zihf2']['instance'].daq.sweep(self._timeout)
        self.sweeper.set('sweep/device', self.instruments['zihf2']['instance'].device)

        self.data = deque()

        # todo: clean this up! and plot data in gui!
        self._sweep_values =  list({'frequency' : [], 'x' : [], 'y' : [], 'phase': [], 'r':[]}.keys())
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:14,代码来源:zi_sweeper.py


示例16: get_iterator_default_script

    def get_iterator_default_script(iterator_type):
        """


        Returns:
            sub_scripts: a dictionary with the default scripts for the script_iterator
            script_settings: a dictionary with the script_settingsfor the default scripts

        """

        sub_scripts = {}
        script_settings = {}

        package = 'b26_toolkit' # todo JG: mabye find a dynamic whay to get this

        # for point iteration we add some default scripts
        if iterator_type == 'iter nvs':

            module = Script.get_script_module('SelectPoints')# Select points is actually in pylabcontrol
            sub_scripts.update(
                {'select_points': getattr(module, 'SelectPoints')}
            )
            module = Script.get_script_module('FindNV', package)
            sub_scripts.update(
                #      {'find_nv': getattr(module, 'FindNV_cDAQ')}
                {'find_nv': getattr(module, 'FindNV')}
            )
            module = Script.get_script_module('Take_And_Correlate_Images', package)
            sub_scripts.update(
                {'correlate_iter': getattr(module, 'Take_And_Correlate_Images', package)}
            )
            script_settings['script_order'] = {'select_points': -3, 'correlate_iter': -2, 'find_nv': -1}

        elif iterator_type == 'iter points':
            module = Script.get_script_module('SelectPoints', 'pylabcontrol')
            sub_scripts.update(
                {'select_points': getattr(module, 'SelectPoints')}
            )
            module = Script.get_script_module('SetLaser', package)
            sub_scripts.update(
                {'set_laser': getattr(module, 'SetLaser')}
            )
            module = Script.get_script_module('Take_And_Correlate_Images', package)
            sub_scripts.update(
                {'correlate_iter': getattr(module, 'Take_And_Correlate_Images')}
            )
            script_settings['script_order']={'select_points': -3, 'correlate_iter': -2, 'set_laser': -1}

        elif iterator_type == 'test':
            module = Script.get_script_module('Wait', 'pylabcontrol')
            sub_scripts.update(
                {'wait': getattr(module, 'Wait')}
            )



        return sub_scripts, script_settings
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:57,代码来源:script_iterator.py


示例17: test_xy8_double_init

    def test_xy8_double_init(self):


        updated_scripts, load_failed, updated_instruments = Script.load_and_append({'XY8': 'XY8_double_init'},
                                                                                   package='b26_toolkit')
        xy8 = updated_scripts['XY8']

        xy8.update({'Tracking': {
            'on/off': False}})  # turn off tracking because this will cause an error if we don't run findnv
        print(xy8)

        xy8.is_valid()
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:12,代码来源:test_pulse_blaster_scripts.py


示例18: __init__

 def __init__(self, instruments, scripts = None, name=None, settings=None, log_function=None, data_path = None):
     Script.__init__(self, name, settings=settings, scripts=scripts, instruments=instruments, log_function=log_function, data_path = data_path)
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:2,代码来源:stability_with_microwaves.py


示例19: visualize_magnetic_fields

def visualize_magnetic_fields(src_folder, target_folder, manual=True):
    filepath = os.path.join(target_folder, os.path.dirname(src_folder).split('./')[1])

    # load the fit_data
    if manual:
        #         df = pd.read_csv(os.path.join(target_folder, '{:s}-manual.csv'.format(folder.split('./')[1].replace('/','-'))), index_col = 'id', skipinitialspace=True)
        filename = '{:s}\\data-manual.csv'.format(os.path.basename(src_folder))
    else:
        filename = '{:s}.csv'.format(os.path.basename(src_folder))
    # df = pd.read_csv(os.path.join(target_folder, '{:s}.csv'.format(folder.split('./')[1].replace('/','-'))), index_col = 'id', skipinitialspace=True)
    df = pd.read_csv(os.path.join(filepath, filename), index_col='id', skipinitialspace=True)
    df = df.drop('Unnamed: 0', 1)

    # include manual corrections
    if manual:
        for id, nv_type in enumerate(df['manual_nv_type']):
            if not pd.isnull(nv_type):
                df.set_value(id, 'NV type', nv_type)
                if nv_type == 'split':
                    df.set_value(id, 'B-field (gauss)', df.get_value(id, 'manual_B_field'))

    # load the image data
    select_points_data = Script.load_data(get_select_points(src_folder))
    image_data = select_points_data['image_data']
    #     points_data = select_points_data['nv_locations']
    extent = select_points_data['extent']

    # prepare figure
    f = plt.figure(figsize=(15, 8))
    gs = gridspec.GridSpec(1, 2, height_ratios=[1, 1])
    ax0 = plt.subplot(gs[0])
    ax1 = plt.subplot(gs[1])
    ax = [ax0, ax1]

    # plot the map
    ax0.imshow(image_data, extent=extent, interpolation='nearest', cmap='pink')

    for nv_type, color in zip(['split', 'bad', 'no_peak', 'single'], ['g', 'k', 'b', 'r']):
        subset = df[df['NV type'] == nv_type]
        ax0.scatter(subset['xo'], subset['yo'], c=color, label=nv_type)

    ax0.legend(bbox_to_anchor=(2.3, 1))

    subset = df[df['NV type'] == 'split']
    for i, j, n in zip(subset['xo'], subset['yo'], subset.index):
        corr = +0.005  # adds a little correction to put annotation in marker's centrum
        ax0.annotate(str(n), xy=(i + corr, j + corr), fontsize=8, color='w')
    ax0.set_xlabel('x (V)')
    ax0.set_ylabel('y (V)')

    # plot the fields on a 1D plot
    subset = df[df['NV type'] == 'split']
    ax1.plot(subset['xo'], subset['B-field (gauss)'] / freq_to_mag * 1e-6, 'o')
    ax1.set_title('ESR Splittings')
    ax1.set_xlabel('x coordinate (V)')
    ax1.set_ylabel('Splitting (MHz)')
    ax1.set_xlim([extent[0], extent[1]])

    ax2 = ax1.twinx()
    mn, mx = ax1.get_ylim()
    ax2.set_ylim(mn * freq_to_mag * 1e6, mx * freq_to_mag * 1e6)
    ax2.set_ylabel('Magnetic Field Projection (Gauss)')

    for i, j, n in zip(subset['xo'], subset['B-field (gauss)'] / freq_to_mag * 1e-6, subset.index):
        corr = 0.0005  # adds a little correction to put annotation in marker's centrum
        ax1.annotate(str(n), xy=(i + corr, j + corr))

    # f.set_tight_layout(True)

    #     f.savefig(os.path.join(target_folder, '{:s}.jpg'.format(os.path.basename(folder))),
    #                bbox_inches='tight',
    # #                transparent=True,
    #                pad_inches=0)

    f.savefig(os.path.join(filepath, '{:s}.jpg'.format(os.path.basename(src_folder))),
              bbox_inches='tight',
              #                transparent=True,
              pad_inches=0)
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:78,代码来源:esr_post_processing.py


示例20: manual_correction

def manual_correction(folder, target_folder, fit_data_set, nv_type_manual, b_field_manual, queue, current_id_queue, lower_peak_widget, upper_peak_widget, lower_fit_widget, upper_fit_widget):
    """
    Backend code to display and fit ESRs, then once input has been received from front-end, incorporate the data into the
    current data set

    Args:
        folders: folder containing the data to analyze
        target_folder: target for processed data
        fit_data_set: starting point data set containing automatically fitted esrs
        nv_type_manual: pointer to empty array to populate with nv type manual corrections
        b_field_manual: pointer to empty array to populate with b field manual corrections
        queue: queue for communication with front-end in separate thread
        lower_peak_widget: widget containing frequency value of lower peak
        upper_peak_widget: widget containing frequency value of upper peak

    Poststate: populates fit_data_set with manual corrections
    """

    lower_peak_manual = [np.nan] * len(fit_data_set)
    upper_peak_manual = [np.nan] * len(fit_data_set)

    filepath = os.path.join(target_folder, folder[2:])
    data_filepath = os.path.join(filepath, 'data-manual.csv')
    if os.path.exists(data_filepath):
        prev_data = pd.read_csv(data_filepath)
        if 'manual_peak_1' in list(prev_data.keys()):
            for i in range(0, len(prev_data['manual_B_field'])):
                b_field_manual[i] = prev_data['manual_B_field'][i]
                nv_type_manual[i] = prev_data['manual_nv_type'][i]
            lower_peak_manual = prev_data['manual_peak_1']
            upper_peak_manual = prev_data['manual_peak_2']


    #TODO: Add saving as you go, add ability to start at arbitrary NV, add ability to specify a next NV number, eliminate peak/correct -> only have 'accept fit'

    try:


        print('STARTING')

        fit_data_set_array = fit_data_set.as_matrix()

        w = widgets.HTML("Event information appears here when you click on the figure")
        display(w)

        # loop over all the folders in the data_subscripts subfolder and retrieve fitparameters and position of NV
        esr_folders = glob.glob(os.path.join(folder, '.\\data_subscripts\\*esr*'))

        # create folder to save images to
        # filepath_image = os.path.join(target_folder, os.path.dirname(folder).split('./')[1])
        # image_folder = os.path.join(filepath_image, '{:s}\\images'.format(os.path.basename(folder)))
        image_folder = os.path.join(target_folder, '{:s}\\images'.format(folder[2:]))
        # image_folder = os.path.normpath(
        #     os.path.abspath(os.path.join(os.path.join(target_folder, 'images'), os.path.basename(folders[0]))))
        if not os.path.exists(image_folder):
            os.makedirs(image_folder)
        if not os.path.exists(os.path.join(image_folder, 'bad_data')):
            os.makedirs(os.path.join(image_folder, 'bad_data'))

        f = plt.figure(figsize=(12, 6))

        def onclick(event):
            if event.button == 1:
                if event.key == 'control':
                    lower_fit_widget.value = event.xdata
                else:
                    lower_peak_widget.value = event.xdata
            elif event.button == 3:
                if event.key == 'control':
                    upper_fit_widget.value = event.xdata
                else:
                    upper_peak_widget.value = event.xdata

        cid = f.canvas.mpl_connect('button_press_event', onclick)

        data_array = []
        data_pos_array = []
        for esr_folder in esr_folders:
            print(esr_folder)
            sys.stdout.flush()
            data = Script.load_data(esr_folder)
            data_array.append(data)
            print('looping')
            sys.stdout.flush()


        nv_folders = glob.glob(folder + '\\data_subscripts\\*find_nv*pt_*')
        for nv_folder in nv_folders:
            data_pos_array.append(Script.load_data(nv_folder))

        while True:


        # for i, esr_folder in enumerate(esr_folders):

            i = current_id_queue.queue[0]
            if i >= len(data_array):
                break

            lower_fit_widget.value = 0
#.........这里部分代码省略.........
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:101,代码来源:esr_post_processing.py



注:本文中的pylabcontrol.core.Script类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python binary.zinc_blende函数代码示例发布时间:2022-05-25
下一篇:
Python rcParams.update函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap