当前位置: 首页>>代码示例>>Python>>正文


Python Script.load_and_append方法代码示例

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


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

示例1: test_xy8_double_init

# 需要导入模块: from pylabcontrol.core import Script [as 别名]
# 或者: from pylabcontrol.core.Script import load_and_append [as 别名]
    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,代码行数:14,代码来源:test_pulse_blaster_scripts.py

示例2: float

# 需要导入模块: from pylabcontrol.core import Script [as 别名]
# 或者: from pylabcontrol.core.Script import load_and_append [as 别名]
        # take settings defined in the script and update with settings for the fields
        dictator = self.instruments['MagnetCoils']['settings']
        dictator.update({'magnetic_fields': {'x_field': float(new_x_field), 'y_field': float(new_y_field), 'z_field': float(new_z_field)}})

        self.instruments['MagnetCoils']['instance'].update(dictator)
        #
        self.log('Magnetic Field set to Bx={:.4}G, By={:.4}G, Bz={:.4}G'.format(self.instruments['MagnetCoils']['instance'].settings['magnetic_fields']['x_field'],
                                                                                self.instruments['MagnetCoils']['instance'].settings['magnetic_fields']['y_field'],
                                                                                self.instruments['MagnetCoils']['instance'].settings['magnetic_fields']['z_field'])
                 )

        print(('requested fields', self.instruments['MagnetCoils']['instance'].requested_fields))
        print(('applied fields', self.instruments['MagnetCoils']['instance'].applied_fields))

        self.data['new_voltages'] = self.instruments['MagnetCoils']['instance'].new_voltages
        self.data['requested_fields'] = self.instruments['MagnetCoils']['instance'].requested_fields
        self.data['applied_fields'] = self.instruments['MagnetCoils']['instance'].applied_fields

if __name__ == '__main__':
    from pylabcontrol.core import Instrument

    instruments, instruments_failed = Instrument.load_and_append({'MagnetCoils': MagnetCoils })

    script, failed, instruments = Script.load_and_append(script_dict={'SetMagneticCoils': SetMagneticCoils}, instruments = instruments)

    script['SetMagneticCoils']._function()

    print(script)
    print(failed)
    # print(instruments)
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:32,代码来源:set_magnetic_coils.py

示例3: range

# 需要导入模块: from pylabcontrol.core import Script [as 别名]
# 或者: from pylabcontrol.core.Script import load_and_append [as 别名]
        self.instruments['daq']['instance'].DI_stop()
        diffData = np.diff(xLineData)

        summedData = np.zeros(len(self.x_array) / self.clockAdjust)
        for i in range(0, int((len(self.x_array) / self.clockAdjust))):
            summedData[i] = np.sum(diffData[(i * self.clockAdjust + 1):(i * self.clockAdjust + self.clockAdjust - 1)])
        # also normalizing to kcounts/sec
        return summedData * (.001 / self.settings['time_per_pt'])



if __name__ == '__main__':
    from pylabcontrol.core import Instrument
    # from b26_toolkit.pylabcontrol.instruments import NI7845RMain
    #
    # fpga = NI7845RMain()
    #
    #
    # g = GalvoScanFPGA(instruments={'NI7845RMain':fpga}, name='test_fpga_scan', settings=None, log_function=None, data_path=None)
    # print(fpga)


    # instruments, failed =  Instrument.load_and_append(instrument_dict ={'NI7845RMain': 'NI7845RMain'}, raise_errors=True )

    script, failed, instruments = Script.load_and_append(script_dict={'GalvoScanFPGA': 'GalvoScanFPGA'}, raise_errors=True)
    #
    print(script)
    print(failed)
# # print(instruments)

开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:31,代码来源:galvo_scan_generic.py

示例4: plot_esr

# 需要导入模块: from pylabcontrol.core import Script [as 别名]
# 或者: from pylabcontrol.core.Script import load_and_append [as 别名]
        if data is None:
            data = self.data

        if not self.settings['track_laser_power']['on/off']:
            plot_esr(axes_list[0], data['frequency'], data['data'], linestyle = 'None', marker = 'o')
        elif self.settings['track_laser_power']['on/off'] and self.settings['daq_type'] == 'PCI':
            plot_esr(axes_list[0], data['frequency'], data['norm_data'], linestyle = 'None', marker = 'o')


    def get_axes_layout(self, figure_list):
        """
        returns the axes objects the script needs to plot its data
        the default creates a single axes object on each figure
        This can/should be overwritten in a child script if more axes objects are needed
        Args:
            figure_list: a list of figure objects
        Returns:
            axes_list: a list of axes objects

        """
        new_figure_list = [figure_list[1]]
        return super(ESR_FM_Dither, self).get_axes_layout(new_figure_list)

if __name__ == '__main__':
    script = {}
    instr = {}
    script, failed, instr = Script.load_and_append({'ESR': 'ESR_dithering'}, script, instr)

    print(script)
    print(failed)
    print(instr)
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:33,代码来源:esr_dithering.py

示例5: ValueError

# 需要导入模块: from pylabcontrol.core import Script [as 别名]
# 或者: from pylabcontrol.core.Script import load_and_append [as 别名]
        min_volts = 0.0
        max_volts = 5.0

        pt = self.get_voltage(self.settings['attenuation'])

        if pt < min_volts or pt > max_volts:
            raise ValueError("Invalid voltage. Must be between 0 and 5 volts")

        task = self.daq_out.setup_AO(self.settings['DAQ_channels'], pt)
        self.daq_out.run(task)
        self.daq_out.waitToFinish(task)
        self.daq_out.stop(task)
        self.log('laser set to attenuation'.format(self.settings['attenuation']))

    def get_voltage(self, attenuation):
        # this function returns the voltage needed for a given attenuation
        # fit to a quartic polynomial

        voltage = a4*attenuation^4 + a3*attenuation^3 + a2*attenuation^2 + a1*attenuation + a0
        return voltage

if __name__ == '__main__':
    from pylabcontrol.core import Instrument

    # instruments, instruments_failed = Instrument.load_and_append({'daq':  'NI6259'})

    script, failed, instruments = Script.load_and_append(script_dict={'SetLaserPower': 'SetLaserPower'})

    print(script)
    print(failed)
    # print(instruments)
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:33,代码来源:set_laser_power.py

示例6: cartesian_to_spherical

# 需要导入模块: from pylabcontrol.core import Script [as 别名]
# 或者: from pylabcontrol.core.Script import load_and_append [as 别名]
        #calculates angle based on the always positive results, so always returns angles in first octant. Thus, after
        #switching polarity, then just plug this angle in
        [_, theta, phi] = cartesian_to_spherical([results['x'], results['y'], results['z']])


        self.data = {'nv_axis_direction': [theta, phi], 'switch_polarity': switch_polarity}

    #must be passed figure with galvo plot on first axis
    def _plot(self, axes_list):
        if self._current_subscript_stage['current_subscript'] == self.scripts['FindNV']:
            self.scripts['FindNV']._plot(axes_list)
        elif self._current_subscript_stage['current_subscript'] == self.scripts['ESR']:
            self.scripts['ESR']._plot(axes_list)
        elif self._current_subscript_stage['current_subscript'] == self.scripts['Correlate']:
            self.scripts['Correlate']._plot(axes_list)

    #must be passed figure with galvo plot on first axis
    def _update_plot(self, axes_list):
        if self._current_subscript_stage['current_subscript'] == self.scripts['FindNV']:
            self.scripts['FindNV']._update_plot(axes_list)
        elif self._current_subscript_stage['current_subscript'] == self.scripts['ESR']:
            self.scripts['ESR']._update_plot(axes_list)
        elif self._current_subscript_stage['current_subscript'] == self.scripts['Correlate']:
            self.scripts['Correlate']._update_plot(axes_list)

if __name__ == '__main__':
    script, failed, instruments = Script.load_and_append(script_dict={'AlignFieldToNV':'AlignFieldToNV'})

    print(script)
    print(failed)
    # print(instruments)
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:33,代码来源:align_magnetic_field_to_NV.py

示例7: plot_counts

# 需要导入模块: from pylabcontrol.core import Script [as 别名]
# 或者: from pylabcontrol.core.Script import load_and_append [as 别名]
            if self.settings['track_laser_power_photodiode1']['on/off'] == True:
                array_to_plot = np.delete(np.divide(np.multiply(self.data['counts'], np.mean(self.data['laser_power'])), self.data['laser_power']),0)
            else:
                array_to_plot = np.delete(data['counts'], 0)

            plot_counts(axes_list[0], array_to_plot)

    def _update_plot(self, axes_list, data = None):
        if data is None:
            data = self.data

        if data:
            if self.settings['track_laser_power_photodiode1']['on/off'] == True:
                array_to_plot = np.delete(np.divide(np.multiply(self.data['counts'], np.mean(self.data['laser_power'])), self.data['laser_power']), 0)
            else:
                array_to_plot = np.delete(data['counts'], 0)

            update_counts_vs_pos(axes_list[0], array_to_plot, np.linspace(0, len(array_to_plot), len(array_to_plot)))


class Daq_Read_Counter_NI6259(Daq_Read_Counter):
    _INSTRUMENTS = {'daq': NI6259}

if __name__ == '__main__':
    script = {}
    instr = {}
    script, failed, instr = Script.load_and_append({'Daq_Read_Cntr': 'Daq_Read_Cntr'}, script, instr)

    print(script)
    print(failed)
    print(instr)
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:33,代码来源:daq_read_counter.py

示例8: __init__

# 需要导入模块: from pylabcontrol.core import Script [as 别名]
# 或者: from pylabcontrol.core.Script import load_and_append [as 别名]
    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']})

    def _function(self):
        """
        This is the actual function that will be executed. It uses only information that is provided in the settings property
        will be overwritten in the __init__
        """
        self.data = {'image_data': self.instruments['Camera']['instance'].get_frame(), 'extent': [0,self.settings['width'], self.settings['height'], 0]}

    def _plot(self, axes_list, data = None):
        """
        Plots camera image to first axis
        :param axes_list: list containing axis to plot to as zeroth element
        :param data:
        """
        plot_fluorescence_new(self.data['image_data'], self.data['extent'], axes_list[0])

if __name__ == '__main__':
    script, failed, instruments = Script.load_and_append(script_dict={'TakeImage': 'TakeImage'})

    print(script)
    print(failed)
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:32,代码来源:take_image_camera.py

示例9: set_galvo_location

# 需要导入模块: from pylabcontrol.core import Script [as 别名]
# 或者: from pylabcontrol.core.Script import load_and_append [as 别名]
            initial_position = []
        return initial_position


    def set_galvo_location(self, galvo_position):
        """
        sets the current position of the galvo
        galvo_position: list with two floats, which give the x and y position of the galvo mirror
        """
        if galvo_position[0] > 1 or galvo_position[0] < -1 or galvo_position[1] > 1 or galvo_position[1] < -1:
            raise ValueError('The script attempted to set the galvo position to an illegal position outside of +- 1 V')

        pt = galvo_position
        # daq API only accepts either one point and one channel or multiple points and multiple channels
        pt = np.transpose(np.column_stack((pt[0], pt[1])))
        pt = (np.repeat(pt, 2, axis=1))

        task = self.daq_out.setup_AO(
            [self.settings['DAQ_channels']['x_ao_channel'], self.settings['DAQ_channels']['y_ao_channel']], pt)
        self.daq_out.run(task)
        self.daq_out.waitToFinish(task)
        self.daq_out.stop(task)

if __name__ == '__main__':
    script, failed, instruments = Script.load_and_append(script_dict={'GalvoScanPhotodiode': 'GalvoScanPhotodiode'})

    print(script)
    print(failed)
    # print(instruments)

开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:31,代码来源:galvo_scan_photodiode.py

示例10: plot_psd

# 需要导入模块: from pylabcontrol.core import Script [as 别名]
# 或者: from pylabcontrol.core.Script import load_and_append [as 别名]
        phase = data['phase']
        phase = phase[np.isfinite(r)]
        r = r[np.isfinite(r)]

        x_scaling = self.settings['xmapping'][0:3]
        y_scaling = self.settings['ymapping'][0:3]

        # plot amplitude
        axes = axes_list[0]
        axes.hold(False)
        plot_psd(freq, r, axes, x_scaling = x_scaling, y_scaling = y_scaling)

        # axes.set_xlim([min(freq), max(freq)])
        axes.set_ylim([min(r), max(r)])
        axes.set_ylabel('amplitude (Vrms)')

        # plot phase
        if not trace_only:
            axes = axes_list[1]
            axes.hold(False)
            plot_psd(freq, phase, axes, x_scaling=x_scaling, y_scaling='lin')
            # axes.set_xlim([min(freq), max(freq)])
            axes.set_ylim([min(phase), max(phase)])
            axes.set_ylabel('phase (rad)')


if __name__ == '__main__':
    script, failed, instruments = Script.load_and_append(script_dict={'ZISweeper': 'ZISweeper'})


开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:30,代码来源:zi_sweeper.py

示例11: stop

# 需要导入模块: from pylabcontrol.core import Script [as 别名]
# 或者: from pylabcontrol.core.Script import load_and_append [as 别名]
            else:
                self.log("All generated pulse sequences are valid. No tau times will be skipped in this experiment.")

            self.log("{:d} different tau times have passed validation".format(len(valid_tau_list)))

        return valid_pulse_sequences, valid_tau_list, measurement_gate_width

    def stop(self):
        """
        Stop currently executed pulse blaster sequence
        NOT CURRENTLY WORKING, WILL CRASH PULSEBLASTER
        """
        # self.instruments['PB']['instance'].stop()
        super(PulsedExperimentBaseScript, self).stop()


if __name__ == '__main__':
    script = {}
    instr = {}
    script, failed, instr = Script.load_and_append({'ExecutePulseBlasterSequence': 'ExecutePulseBlasterSequence'},
                                                   script, instr)

    script, failed, instr = Script.load_and_append({'ExecutePulseBlasterSequence': {'class':'ExecutePulseBlasterSequence',
                                                                                    'package':'b26toolkit'}},
                                                   script, instr)


    print(script)
    print(failed)
    print(instr)
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:32,代码来源:pulsed_experiment_base_script.py

示例12: plot_fluorescence_new

# 需要导入模块: from pylabcontrol.core import Script [as 别名]
# 或者: from pylabcontrol.core.Script import load_and_append [as 别名]
                axes_list[1].set_title('correlation image')

            # plot new image
            if not self.data['new_image'] == []:
                if not self.settings['display_processed_images']:
                    plot_fluorescence_new(self.data['new_image'], self.data['new_image_extent'], axes_list[2])
                else:
                    plot_fluorescence_new(self.new_processed_image, self.data['new_image_extent'], axes_list[2])
                axes_list[2].set_title('new image shifted by dx={:0.3f} dy={:0.3f}'.format(self.data['shift'][0], self.data['shift'][1]))


    def _update_plot(self, axes_list):
        '''
        Plots the newly taken galvo scan to axis 2, and the correlation image to axis 1
        Args:
            axes_list: list of axes to plot to. Uses two axes.

        '''
        if self.scripts['take_baseline_image'].is_running:
            self.scripts['take_baseline_image']._update_plot(axes_list)
        elif self.scripts['take_new_image'].is_running:
            self.scripts['take_new_image']._update_plot(axes_list)
        else:
            self._plot(axes_list)

if __name__ == '__main__':
    script, failed, instr = Script.load_and_append({'Correlate_Images': Take_And_Correlate_Images})

    print(script)
    print(failed)
    print(instr)
开发者ID:LISE-B26,项目名称:b26_toolkit,代码行数:33,代码来源:correlate_images.py


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