Пример #1
0
def getMirnovs2(shot_,
                node=mirnv_marte_corr,
                ADC=False,
                polarity=True,
                slope=False):
    coilNr = 0
    data = []
    pol = 1.
    adc_factor = 1.
    if ADC:
        adc_factor = 0.85e-10
    for coil in node:
        coilNr += 1
        #polarity correction
        if coilNr not in [1, 2, 4, 11] and polarity:
            pol = -1.
        else:
            pol = 1.
        times, coilData, tbs = getSignal(sdasClient, coil, shot_)
        #correct slope
        sl = np.zeros(len(coilData))
        if slope and node == mirnv_int:
            f = 100  #correction length for slope calculation
            sl = np.linspace(np.mean(coilData[0:f]),
                             np.mean(coilData[-f - 1:-1]),
                             num=len(coilData))
        coilData = pol * (coilData - sl) * adc_factor  #positive polarity
        data.append(coilData)
    return times, data
Пример #2
0
def calcPostWoMirnov(sdasClient, shot_=0, node=mirnv_int):
    slopes = []
    for coil in node:
        times, coilData, tbs = getSignal(sdasClient, coil, shot_)
        postWo = coilData[-1] / len(
            times) / decimateMARTe  #  times[-1] /1e-6) / Fsampling  # inn LSB
        slopes.append(postWo)
    WoArr = np.array(slopes)
    return WoArr
Пример #3
0
def getFluxCoilData(sdasClient, shot_, nodes=flux_int):
    #    coilNr=0
    data = []

    for coil in nodes:
        #      coilNr+=1
        times, coilData, tbs = getSignal(sdasClient, coil, shot_)
        data.append(coilData)

    dataArr = np.array(data)
    return times, dataArr
Пример #4
0
def getMARTeWo(sdasClient, coilNr=0, shot_=0):
    #    node=mirnv_int
    coil = mirnv_marte_corr[coilNr]
    times, coilData, tbs = getSignal(sdasClient, coil, shot_)
    #    slopes=[]
    #    for coil in node:
    #        coilData, times, tbs = getSignal(sdasClient, coil, shot_)
    #        postWo = coilData[-1] / len(times) /decimateMARTe#  times[-1] /1e-6) / Fsampling  # inn LSB
    #        slopes.append(postWo)
    WoNumbers = coilData[0:10] * 1e10  # To rescale to LSB
    return WoNumbers
Пример #5
0
def getMirnCalib(sdasClient, shot_):
    nodes = mirnv_calib
    # coilNr=0
    data = []
    #  slopes=[]
    for coil in nodes:
        times, coilData, tbs = getSignal(sdasClient, coil, shot_)
        data.append(coilData)

    DataArr = np.array(data)
    return times, DataArr
Пример #6
0
def getMirnovs(shot_, node=mirnv_marte_corr, correct=True):
    coilNr = 0
    data = []

    for coil in node:
        coilNr += 1
        times, coilData, tbs = getSignal(sdasClient, coil, shot_)
        if correct:
            f = 100  #correction length for slope calculation
            slope = 0.0

            #if node==mirnv_int:
            #    slope=np.linspace(np.mean(coilData[0:f]), np.mean(coilData[-f-1:-1]), num=len(coilData))

            if coilNr in [1, 2, 4, 11]:
                coilData = (coilData - slope) * 0.85e-10  #positive polarity
            else:
                coilData = -(coilData - slope) * 0.85e-10  #negative polarity
        data.append(coilData)
    return times, data
Пример #7
0
def getMirnovInt(sdasClient, shot_, correctWO='None', correctPol=True):
    node = mirnv_int
    coilNr = 0
    data = []
    slopes = []
    for coil in node:
        times, coilData, tbs = getSignal(sdasClient, coil, shot_)
        slp = 0.0
        if correctWO == 'Pre':
            lineWo = WoCorr[coilNr] * np.arange(len(times)) * decimateMARTe
            coilData = coilData - lineWo

        if correctWO == 'Post':
            LastPt = 300
            slp = coilData[-LastPt] / (len(coilData) - LastPt
                                       )  #/ decimateMARTe # in LSB
            lineWo = np.arange(len(coilData)) * slp
            coilData = coilData - lineWo
            #slope = np.linspace(0.0, slp * len(coilData), num=len(coilData))
        coilNr += 1
        if correctPol:
            if coilNr in [1, 2, 4, 11]:
                coilData = -coilData  #reverse polarity


#        coilNr +=1
        if shot_ > 44078:  #  5 September moduels correctio , from 1.0/11.0 to 10.0/11.0
            data.append(coilData * 0.85e-10 /
                        10.0)  # Return values in V.s units
        else:
            data.append(coilData * 0.85e-10)  # Return values in V.s units
        slp = slp / decimateMARTe  # in LSB
        slopes.append(slp)

    #slpf= np.array(slopes)
    #print(np.array2string(slpf, precision=4))
    #print(slopes)
    #print(times[-1])
    return times, data
    return signals


if __name__ == "__main__":

    #SDAS DATA
    client = StartSdas()
    shotP = 44501
    shotH = 44330
    shotV = 44278
    #%matplotlib qt4
    times, mirnovs_P = getMirnovInt(client, shotP, 'Post')
    times, mirnovs_H = getMirnovInt(client, shotH, 'Post')
    times, mirnovs_V = getMirnovInt(client, shotV, 'Post')

    timesp, Ip_prim, tbs = getSignal(client, ch_prim, shotP)
    timesp, Ip_hor, tbs = getSignal(client, ch_hor, shotP)
    timesp, Ip_vert, tbs = getSignal(client, ch_vert, shotP)

    timesh, Ih_prim, tbs = getSignal(client, ch_prim, shotH)
    timesh, Ih_hor, tbs = getSignal(client, ch_hor, shotH)
    timesh, Ih_vert, tbs = getSignal(client, ch_vert, shotH)

    timesv, Iv_prim, tbs = getSignal(client, ch_prim, shotV)
    timesv, Iv_hor, tbs = getSignal(client, ch_hor, shotV)
    timesv, Iv_vert, tbs = getSignal(client, ch_vert, shotV)

    np.set_printoptions(precision=3)

    #ResCopper = 1.0e-4 # 0.1 mOhm
    aCopper = 10.0e-3  # 'wire' radius 10 mm
Пример #9
0
    bPolIs2 = np.matmul(Is2Bpol2, IsPfc)
    tout2, Ic2, x2 = signal.lsim(magSys2, IsPfc.T, time)
    bPolIc2 = np.matmul(Ic2Bpol, Ic2.T)
    bPolTot2 = (bPolIs2.T + bPolIc2.T) * 50 * 49e-6
    return bPolTot2, (RIc, ZIc)


if __name__ == "__main__":

    #SDAS DATA
    client = StartSdas()
    shotP = 44501
    shotH = 44330
    #%matplotlib qt4
    times, mirnovs = getMirnovInt(client, shotH, 'Post')
    timesp, I_prim, tbs = getSignal(client, ch_prim, shotH)
    timesh, I_hor, tbs = getSignal(client, ch_hor, shotH)

    np.set_printoptions(precision=3)
    currPrim = I_prim[10:]
    currHor = I_hor[10:]
    nc = 15  # number of coppe2r shell 'wires'

    ResCopper = 1.0e-4  # 0.1 mOhm
    aCopper = 10.0e-3  # 'wire' radius 10 mm

    currVert = np.zeros_like(currPrim)
    #currHor=np.zeros_like(currPrim) # Zero current on Hori Field Coils

    IsPfc = np.array([currVert, currHor, currPrim])