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


Python pyfusion.getDevice函数代码示例

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


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

示例1: get_data

    def get_data(self,):
        self.data = pf.getDevice('H1').acq.getdata(self.shot, self.array).reduce_time([self.start_time, self.end_time])
        self.data = self.data.subtract_mean(copy=False).normalise(method='v',separate=True,copy=False)
        self.timebase = self.data.timebase
        self.data_fft = self.data.generate_frequency_series(self.samples,self.samples/self.overlap)

        print self.other_arrays, self.other_array_labels
        if self.other_arrays == None: self.other_array_labels = []
        if self.other_arrays == None: self.other_arrays = []; 
        if self.meta_data == None : self.meta_data = []

        self.other_arrays_fft = []
        for i in self.other_arrays:
            tmp = pf.getDevice('H1').acq.getdata(self.shot, i).change_time_base(self.data.timebase)
            self.other_arrays_fft.append(tmp.generate_frequency_series(self.samples,self.samples/self.overlap))

        self.instance_array_list = []
        self.misc_data_dict = {}

        #How to deal with the static case?
        for i in self.other_array_labels: 
            if i[0]!=None:  self.misc_data_dict[i[0]] = []
            if i[1]!=None:  self.misc_data_dict[i[1]] = []

        #self.fs_values = ['p','a12','H','freq','E']
        for i in self.meta_data: self.misc_data_dict[i]=[]
开发者ID:shaunhaskey,项目名称:pyfusion,代码行数:26,代码来源:extract_features_scans.py

示例2: extract_polarisation_data

def extract_polarisation_data(current_shot):
    try:
        #MDSTree=MDS.Tree('mirnov',current_shot)
        coil_1x=pf.getDevice('H1').acq.getdata(current_shot,'H1ToroidalMirnov_1x')
        coil_1y=pf.getDevice('H1').acq.getdata(current_shot,'H1ToroidalMirnov_1y')
        coil_1z=pf.getDevice('H1').acq.getdata(current_shot,'H1ToroidalMirnov_1z')
        #Need to narrow the time down.... maybe extract the above data elsewhere
        #print 'successful extraction of pyrex coil'
        return coil_1x, coil_1y, coil_1z
    except:
        print 'Error getting polarisation data'
        return 0,0,0
开发者ID:shaunhaskey,项目名称:python-h1,代码行数:12,代码来源:HMA_funcs.py

示例3: __init__

    def __init__(self, shot, i_diag, v_diag, dev_name="W7X", debug=debug, plot=1, verbose=0, params=None):
        self.dev = pyfusion.getDevice(dev_name)
        self.shot = shot
        self.verbose = verbose
        self.i_diag = i_diag
        self.v_diag = v_diag
        self.debug = debug
        self.plot = plot
        self.select = None
        self.t_comp = (0.1,0.2)
        self.params = params
        self.figs = []
        self.suffix = ''  # this gets put at the end of the fig name (title bar)

        self.imeasfull = self.dev.acq.getdata(shot, i_diag)
        self.vmeasfull = self.dev.acq.getdata(shot, v_diag)
        comlen = min(len(self.vmeasfull.timebase), len(self.imeasfull.timebase))
        FFT_size = nice_FFT_size(comlen-2, -1)
        # the minus 2 is a fudge to hide small inconsistencies in reduce_time
        # e.g. 20160310 9 W7X_L5_LPALLI
        self.imeasfull = self.imeasfull.reduce_time([self.imeasfull.timebase[0], self.imeasfull.timebase[FFT_size]])
        self.vmeasfull = self.vmeasfull.reduce_time([self.vmeasfull.timebase[0], self.vmeasfull.timebase[FFT_size]])

        if self.params is not None:
            self.process_swept_Langmuir(**self.params)
开发者ID:bdb112,项目名称:pyfusion,代码行数:25,代码来源:process_swept_Langmuir.py

示例4: test_single_mirnov_channel_kappah_from_metadata

 def test_single_mirnov_channel_kappah_from_metadata(self):
     h1test = pyfusion.getDevice("H1")
     # shot_kh = (58073, 0.74)
     shot_kh = (58123, 0.74)
     # TODO: why doesn't this work with thick client??
     data = h1test.acq.getdata(shot_kh[0], "H1_mirnov_array_1_coil_1")
     print(shot_kh)
开发者ID:bdb112,项目名称:pyfusion,代码行数:7,代码来源:tests.py

示例5: test_plot_signals

 def test_plot_signals(self):
     # in this position, the local data/test.cfg is used, so to run separately,
     # you need to point your PYTHON_CONFIG_FILE at that file.
     # - doesn't work as of Mar 7   - 
     dev = pyfusion.getDevice('H1')
     print('\n'.join(pyfusion.conf.utils.dump(eol='')))
     dat = dev.acq.getdata(58123,'Test_H1_multi_small')
     dat.plot_signals()
开发者ID:dpretty,项目名称:pyfusion,代码行数:8,代码来源:tests.py

示例6: test_single_mirnov_channel_kappah_as_argument

    def test_single_mirnov_channel_kappah_as_argument(self):
        d = pyfusion.getDevice("H1")
        data = d.acq.getdata(58123, "H1_mirnov_array_1_coil_1")
        self.assertTrue(isinstance(data, TimeseriesData))
        from pyfusion.data.base import PfMetaData

        self.assertTrue(isinstance(data.meta, PfMetaData))
        """
开发者ID:bdb112,项目名称:pyfusion,代码行数:8,代码来源:tests.py

示例7: test_device_getdata_single_shot

    def test_device_getdata_single_shot(self):
        dev = pyfusion.getDevice("TestDevice")

        # what we want...
        expected_data = dev.acq.getdata(12345, "test_timeseries_shot_unique")
        # what we get....
        data = dev.getdata(12345, "test_timeseries_shot_unique")
        self.assertEqual(expected_data, data)
开发者ID:bdb112,项目名称:pyfusion,代码行数:8,代码来源:tests.py

示例8: test_get_data

    def test_get_data(self):
        """Check that we end up with the correct data class starting from Device"""
        from pyfusion import getDevice

        test_device = getDevice(self.listed_device)
        test_data = test_device.acquisition.getdata(self.shot_number, timeseries_test_channel_1)
        from pyfusion.data.timeseries import TimeseriesData

        self.assertTrue(isinstance(test_data, TimeseriesData))
开发者ID:bdb112,项目名称:pyfusion,代码行数:9,代码来源:tests.py

示例9: get_array_data

def get_array_data(current_shot, array_name, time_window=None,new_timebase=None):
    array_cutoff_locs = [0]
    data = pf.getDevice('H1').acq.getdata(current_shot, array_name)
    if new_timebase!=None:
        print('interpolating onto a new timebase....')
        data = data.change_time_base(new_timebase)
    if time_window!=None:
        data = data.reduce_time(time_window)
    return data
开发者ID:bdb112,项目名称:pyfusion,代码行数:9,代码来源:extract_features_scans.py

示例10: extract_data

def extract_data(current_shot,array):
    tries,success=(0,0)
    while tries<10 and success==0:
        try:
            data=pf.getDevice('H1').acq.getdata(current_shot,array)
            success=1
            #print 'Data extracted on Shot : %d'%(current_shot)
        except (MDS.TdiException, MDS.TreeException) as e:
            print current_shot, e
            tries=tries+1
            time.sleep(0.5)
            data=None
    return data
开发者ID:shaunhaskey,项目名称:python-h1,代码行数:13,代码来源:HMA_funcs.py

示例11: test_shot_flucstrucs

    def test_shot_flucstrucs(self):
        """Just check that the number  of flucstrucs is the same whether
        we  use flucstruc  directly on  the shot  data with  the segment
        kwarg or whether we explicitly call the segment method.

        """
        n_samples = 90
        dev = pyfusion.getDevice("TestDevice")

        # version with explicit calls to segment:
        explicit_data = dev.getdata(12345,"test_multichannel_timeseries_large")
        explicit_dataset = pyfusion.data.base.DataSet()        
        for seg in explicit_data.segment(n_samples):
            explicit_dataset.update(seg.flucstruc())

        # version using flucstruc segment shortcut
        shortcut_flucstrucs = dev.getdata(12345,"test_multichannel_timeseries_large").flucstruc(segment=n_samples)
        self.assertEqual(len(explicit_dataset), len(shortcut_flucstrucs))
开发者ID:dpretty,项目名称:pyfusion,代码行数:18,代码来源:tests.py

示例12: test_device_getdatat_multishot

    def test_device_getdatat_multishot(self):
        dev = pyfusion.getDevice("TestDevice")

        diag = "test_timeseries_shot_unique"

        shot_list = [100, 200, 300]

        # expected to get a dataset with the data from each shot
        expected_dataset = pyfusion.data.base.DataSet()
        for shot in shot_list:
            expected_dataset.add(dev.acq.getdata(shot, diag))
        
        dataset = dev.getdata(shot_list, diag)

        # TODO: better checking if two datasets are same.
        ## using sets checks if the object is same, not using __eq__ ?
        for i in dataset:
            is_in_other = False
            for j in expected_dataset:
                if i == j:
                    is_in_other = True
            if not is_in_other:
                assert False
开发者ID:bdb112,项目名称:pyfusion,代码行数:23,代码来源:tests.py

示例13: single_shot_fluc_strucs

def single_shot_fluc_strucs(shot=None, array=None, other_arrays=None, other_array_labels=None, start_time=0.001, end_time = 0.08, samples=1024, power_cutoff = 0.1, n_svs = 2, overlap = 4, meta_data=None):
    '''This function will extract all the important information from a
    flucstruc and put it into the form that is useful for clustering
    using hte clustering module.

    SH: 8June2013 '''
    print(os.getpid(), shot)
    time_bounds = [start_time, end_time]

    #extract data for array, naked_coil and ne_array, then reduce_time, interpolate etc...
    data = pf.getDevice('H1').acq.getdata(shot, array).reduce_time([start_time, end_time])
    data = data.subtract_mean(copy=False).normalise(method='v',separate=True,copy=False)
    data_segmented = data.segment(samples,overlap=overlap, datalist = 1)
    print(other_arrays, other_array_labels)
    if other_arrays is None: other_array_labels = []
    if other_arrays is None: other_arrays = []; 
    if meta_data is None : meta_data = []

    #Get the naked coil and interferometer array if required
    #Need to include the standard interferometer channels somehow.
    other_arrays_segmented = []
    for i in other_arrays:
        tmp = pf.getDevice('H1').acq.getdata(shot, i).change_time_base(data.timebase)
        other_arrays_segmented.append(tmp.segment(samples, overlap = overlap, datalist = 1))
    instance_array_list = []
    misc_data_dict = {'RMS':[],'time':[], 'svs':[]}

    #How to deal with the static case?
    for i in other_array_labels: 
        if i[0]!=None:  misc_data_dict[i[0]] = []
        if i[1]!=None:  misc_data_dict[i[1]] = []
    #This should probably be hard coded in... 
    fs_values = ['p','a12','H','freq','E']
    for i in meta_data: misc_data_dict[i]=[]
    for i in fs_values: misc_data_dict[i]=[]

    #Cycle through the time segments looking for flucstrucs
    for seg_loc in range(len(data_segmented)):
        data_seg = data_segmented[seg_loc]
        time_seg_average_time = np.mean([data_seg.timebase[0],data_seg.timebase[-1]])
        fs_set = data_seg.flucstruc()
        #Need to check my usage of rfft.... seems different to scipy.fftpack.rfft approach
        other_arrays_data_fft = []
        for i in other_arrays_segmented:
            other_arrays_data_fft.append(np.fft.rfft(i[seg_loc].signal)/samples)
            if not np.allclose(i[seg_loc].timebase,data_seg.timebase): 
                print("WARNING possible timebase mismatch between other array data and data!!!")
        d = (data_seg.timebase[1] - data_seg.timebase[0])
        val = 1.0/(samples*d)
        N = samples//2 + 1
        frequency_base = np.round((np.arange(0, N, dtype=int)) * val,4)
        #get the valid flucstrucs
        valid_fs = []
        for fs in fs_set:
            if (fs.p > power_cutoff) and (len(fs.svs()) >= n_svs): valid_fs.append(fs)
        #extract the useful information from the valid flucstrucs
        for fs in valid_fs:
            for i in fs_values: misc_data_dict[i].append(getattr(fs,i))
            misc_data_dict['svs'].append(len(fs.svs()))
            #for i in meta_values: misc_data_dict[i].append(eval(i))
            for i in meta_data:
                try:
                    misc_data_dict[i].append(copy.deepcopy(data.meta[i]))
                except KeyError:
                    misc_data_dict[i].append(None)
            misc_data_dict['RMS'].append((np.mean(data.scales**2))**0.5)
            misc_data_dict['time'].append(time_seg_average_time)
            #other array data
            tmp_loc = np.argmin(np.abs(misc_data_dict['freq'][-1]-frequency_base))
            for i,tmp_label in zip(other_arrays_data_fft, other_array_labels):
                if tmp_label[0]!=None: misc_data_dict[tmp_label[0]].append(np.abs(i[:,0]))
                if tmp_label[1]!=None: misc_data_dict[tmp_label[1]].append(np.abs(i[:,tmp_loc]))
            phases = np.array([tmp_phase.delta for tmp_phase in fs.dphase])
            phases[np.abs(phases)<0.001]=0
            instance_array_list.append(phases)
    #convert lists to arrays....
    for i in misc_data_dict.keys():misc_data_dict[i]=np.array(misc_data_dict[i])
    return np.array(instance_array_list), misc_data_dict
开发者ID:bdb112,项目名称:pyfusion,代码行数:78,代码来源:extract_features_scans.py

示例14: test_getDevice_from_pf

 def test_getDevice_from_pf(self):
     device = pyfusion.getDevice("H1")
开发者ID:bdb112,项目名称:pyfusion,代码行数:2,代码来源:tests.py

示例15: exec

exec(pf.utils.process_cmd_line_args())
if help==1: 
    print(__doc__) 
    exit()

#dev_name='LHD'
if dev_name == 'LHD': 
    if diag_name == '': diag_name= 'MP2010'
    if shot_number is None: shot_number = 27233
    #shot_range = range(90090, 90110)
elif dev_name.find('H1')>=0: 
    if diag_name == '': diag_name = "H1DTacqAxial"
    if shot_number is None: shot_number = 69270


device = pf.getDevice(dev_name)

try:
    old_shot
except:
    old_shot=0


if old_shot>0: # we can expect the variables to be still around, run with -i
    if (old_diag != diag_name) or (old_shot != shot_number): old_shot=0

if old_shot == 0: 
    d = device.acq.getdata(shot_number, diag_name) # ~ 50MB for 6ch 1MS. (27233MP)
    old_shot = shot_number
    old_diag = diag_name
开发者ID:bdb112,项目名称:pyfusion,代码行数:30,代码来源:plot_svd_simple.py


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