Exemplo n.º 1
0
    def prepare_sweeps(self, rest_swp='auto', sweep_freq=500, Vpp=90*2, clip_level_minus=-88):
        """ extracts sweep voltage data for all probes,
        call restore_sin if necessary
        Initially, the voltage data is assumed to be in a dictionary
        """
        if self.debug > 0:
            print('entering prepare_sweeps ', len(self.vmeasfull.signal[0]))
        if str(rest_swp).lower() == 'auto':
            rest_swp = self.shot[0]>20160309
            print ('* Automatically setting rest_swp to {r} *'.format(r=rest_swp))

        if rest_swp:
            from pyfusion.data.restore_sin import restore_sin
        self.vcorrfull = self.vmeasfull.copy()
        if rest_swp:
            for (c, sig) in enumerate(self.vmeasfull.signal):
                self.vcorrfull.signal[c] = restore_sin(self.vmeasfull, chan=c, sweep_freq=sweep_freq,
                                                       Vpp=Vpp, clip_level_minus=clip_level_minus, verbose=self.verbose)
Exemplo n.º 2
0
# Hilbert transform creates a transient at 0 - skip first and last 3000
w_plasma = np.where((np.abs(iprobe) > threshold) & (tb > tb[3000]) & (tb < tb[-3000]))[0]
if t_subrange is None:
    t_subrange = [tb[w_plasma[0]], tb[w_plasma[-1]]]

if debug>1:
    plt.plot(tb, iprobe,'g',label='R and phase')
    plt.xlim(t_subrange[0]-.05, t_subrange[0]+.05)
    if debug > 1: mainax.plot(t_subrange, [0, 0],'c*-', linewidth=3)
    plt.legend(prop=dict(size='small'))

if restore_sweep:
    from pyfusion.data.restore_sin import restore_sin
    debug_(debug, 4, key='before_restore_sweep')
    # for now, don't reduce time in restore_sin, because we want both single and multi segments to work
    sweepV = restore_sin(sweepVmeas_rdata, clip_level_minus=restore_sweep, t_range=None)
    # for now, put it back in the data object - a little messy - is it legal?
    # probably better to return a new data object, as it could be
    # faster to reduce the time base to a nicer number for FFTs
    sweepVmeas_rdata.signal = sweepV

if len(t_range) == 2:  # ==> one manual fit - not an auto series
    inds = np.where((tb>t_range[0]) & (tb<t_range[1]))[0] 

    sweepV = sweepV[inds]
    tb = tb[inds]
    imeas = imeas[inds]
    iprobe = iprobe[inds]

    # doesn't matter if we look for clipping in restore vsweep - there shouldn't be any if it is restored
    good = find_clipped([sweepV, imeas],fact=fact)
Exemplo n.º 3
0
# Hilbert transform creates a transient at 0 - skip first and last 3000
w_plasma = np.where((np.abs(iprobe) > threshold) & (tb > tb[3000]) & (tb < tb[-3000]))[0]
if t_subrange is None:
    t_subrange = [tb[w_plasma[0]], tb[w_plasma[-1]]]

if debug>1:
    plt.plot(tb, iprobe,'g',label='R and phase')
    plt.xlim(t_subrange[0]-.05, t_subrange[0]+.05)
    if debug > 1: mainax.plot(t_subrange, [0, 0],'c*-', linewidth=3)
    plt.legend(prop=dict(size='small'))

if restore_sweep:
    from pyfusion.data.restore_sin import restore_sin
    debug_(debug, 4, key='before_restore_sweep')
    # for now, don't reduce time in restore_sin, because we want both single and multi segments to work
    sweepV = restore_sin(sweepVmeas_rdata, clip_level_minus=restore_sweep, t_range=None)
    # for now, put it back in the data object - a little messy - is it legal?
    # probably better to return a new data object, as it could be
    # faster to reduce the time base to a nicer number for FFTs
    sweepVmeas_rdata.signal = sweepV

if len(t_range) == 2:  # ==> one manual fit - not an auto series
    inds = np.where((tb>t_range[0]) & (tb<t_range[1]))[0] 

    sweepV = sweepV[inds]
    tb = tb[inds]
    imeas = imeas[inds]
    iprobe = iprobe[inds]

    # doesn't matter if we look for clipping in restore vsweep - there shouldn't be any if it is restored
    good = find_clipped([sweepV, imeas],fact=fact)