Esempio n. 1
0
def wavefront_abberations(wfo,
                          npupil,
                          atm_screen,
                          NCPA,
                          Island_Piston,
                          TILT=[0, 0],
                          Debug='False',
                          Debug_print='False',
                          prefix='test'):

    lamda = proper.prop_get_wavelength(wfo)

    if (isinstance(atm_screen, (list, tuple, np.ndarray)) == True) and (
            atm_screen.ndim >= 2):  # when the atmosphere is present
        atmosphere(wfo, npupil, atm_screen, Debug_print, Debug)

    if (isinstance(NCPA, (list, tuple, np.ndarray))
            == True) and (NCPA.ndim >= 2):  # when the atmosphere is present
        NCPA_application(wfo, npupil, NCPA, Debug_print, Debug)

    if (all(v == 0
            for v in Island_Piston) == False):  # when the piston is present
        island_effect_piston(wfo, npupil, Island_Piston, Debug_print, Debug)

    if (TILT.any != 0.):  # when tip/tilt
        if (Debug_print == True):
            print("TILT: ", TILT)
            print("lamda: ", lamda)
        tiptilt = (np.multiply(
            TILT, lamda
        )) / 4  # translate the tip/tilt from lambda/D into RMS phase errors
        proper.prop_zernikes(wfo, [2, 3], tiptilt)  # 2-->xtilt, 3-->ytilt

    return wfo
def Thrust(T0, BPR, h_ft, M):
    # Calculo da tracao do motor
    # Ref: Howe - Aircraft Conceptual Design Synthesis
    #--------------------------------------------------------------------------
    atm = atmosphere(h_ft, 0)
    rho = atm.ro
    sigma = rho / 1.225

    if M < 0.40:
        K1 = 1
        K2 = 0
        K3 = -0.60
        K4 = -0.04
    else:
        K1 = 0.88
        K2 = -0.016
        K3 = -0.30
        K4 = 0

    slinha = 0.70

    if h_ft > 36089:
        slinha = 1

    tau_factor = (K1 + K2 * BPR + (K3 + K4 * BPR) * M) * (sigma**slinha)
    T = T0 * tau_factor

    return (T)
def TSFC(c_ref,href_ft,Mref,BPR,h_ft,M):
    # Calculo do consumo especifico do motor
    # Valores de refer�ncia s�o para a MMO na altitude de cruzeiro
    # Ref: Howe - Aircraft Conceptual Design Synthesis
    #--------------------------------------------------------------------------
    # Passo 1: Ajusta parametro para condicao de referencia
    atm=atmosphere(href_ft,0)
    rho=atm.ro
    sigma_ref=rho/1.225
    T1=(1-0.15*(BPR**0.65))
    T2=(1+0.28*(1+0.063*BPR*BPR)*Mref)
    c_linha= c_ref/(T1*T2*(sigma_ref**0.08))
    # Passo 2: Calculo no ponto desejado
    atm=atmosphere(h_ft,0)
    sigma=atm.ro/1.225
    T2=(1+0.28*(1+0.063*BPR*BPR)*M)
    c=c_linha*T1*T2*(sigma**0.08)

    return(c)
Esempio n. 4
0
def cd0_Torenbeek(nmach, swm2, bw, wMAC, tc, df, h, swetm2):
    ISADEV = 0
    atm = atmosphere(h, ISADEV)
    ni = atm.visc / atm.ro
    V = nmach * atm.va
    #
    reybar = V * swetm2 / bw / ni
    # rphi = 4 para avioes ah helice = 3,5 para avioes ah jato
    #
    rphi = 3.5
    sfront = np.pi * df**2 / 4 + 2 * (wMAC * tc * bw / 2)
    #
    knid = 1 + 255 * (reybar**-0.35)  # Page 104 Torenbeek (jet airplanes)
    # CD0=0.044*(reybar^(-1/6))*knid*(swetm2+rphi*sfront)
    # CD0=CD0/swm2
    cfval = cf_flat_plate(reybar, nmach, h)
    CD0 = cfval * knid * (swetm2 + rphi * sfront) / swm2
    return (CD0)
def test_lat_slice(atm, lat, func, fname):
    atm = atmosphere.atmosphere("file.anl")
    lon_range = np.linspace(atm.lon_min, atm.lon_max,
                            2 * (atm.lon_max - atm.lon_min + 1))
    h_range = np.linspace(0, atm.h_ar[0][0][-1], 2 * len(atm.levels))

    nx = len(lon_range)
    ny = len(h_range)
    data = np.zeros((ny, nx))
    for i in range(len(lon_range)):
        for j in range(len(h_range)):
            data[j][i] = func(lat, lon_range[i], h_range[j])
    fig, ax = plt.subplots(1, 1)
    P = ax.pcolormesh(lon_range, h_range, data)
    fig.colorbar(P, ax=ax)
    ax.set_ylabel("height (m)")
    ax.set_xlabel("log (deg)")
    ax.legend()
    fig.savefig(fname, dpi=300)
def check_2ndseg(AirportElevation,wS,bw,wMAC,tcmed,
    neng,bflap,FusDiam,clmaxt,
    W,VTS,VTSweep,ediam,ebypass,dflecflaptakeoff,k_ind_inc,Swet_tot):
    #--------------------------------------------------------------------------
    # Required T/W  for 2nd segment climb 
    #--------------------------------------------------------------------------
    g       = 9.80665
    rad     = np.pi/180
    ft2m    = 0.3048
    m2ft    = 1./ft2m
    #--------------------------------------------------------------------------
    #--------------------------------------------------------------------------

    atm    = atmosphere(AirportElevation*m2ft,0)
    ro     = atm.ro # densidade [kg/m�]
    va     = atm.va # velocidade do som [m/s]
    #--------------------------------------------------------------------------
    cl2seg              = clmaxt/1.44
    V                   = np.sqrt((W*g)/(cl2seg*wS*0.50*ro))
    M                   = V/va
    M                   = max(0.20,M)
    V                   = M*va
    q                   = (1/2)*ro*V*V
    cl2seg              = (W*g)/(q*wS)
    CD0_airp_inc        = cd0_Torenbeek(M,wS,bw,wMAC,tcmed,FusDiam,AirportElevation*m2ft,Swet_tot)
    CD_airp             = CD0_airp_inc + k_ind_inc*(cl2seg**2)
    # Drag increase due to flaps and rudder deflection
    dcdflapetakeoff     = Drag_flap(dflecflaptakeoff,bflap)
    dcdrudder           = 0.0020*np.cos(rad*VTSweep)*(VTS/wS) 
    dcdwindmilli        = CDWINDMILLTOREN(M,ediam,ebypass)
    #
    cd2seg              = CD_airp+dcdflapetakeoff+dcdrudder+(dcdwindmilli/wS)
    ld2seg              = cl2seg/cd2seg
    #
    w2seg = 1
    if neng ==2:
        w2seg =2*(1/ld2seg+np.arctan(0.024))
    elif neng ==3:
        w2seg =(3/2)*(1/ld2seg+np.arctan(0.027))
    elif neng ==4:
        w2seg =(4/3)*(1/ld2seg+np.arctan(0.03))
 
    return(w2seg)
Esempio n. 7
0
def cruzeiro_longrange(Hft,masscruzi,
    arw,sw,wMAC,rangem,MMO,
    afilam, nedebasa,phi14,df,ctref,Href,Mref,BPR,tcroot,tcbreak,tctip,
    Swet_tot):
    # This routine calculates the fuel mass burned during cruise
    tcmed = (0.50*(tcroot+tcbreak) + 0.50*(tcbreak+tctip))/2 # average section max. thickness of the wing
    #
    atm   = atmosphere(Hft,0)
    rhoi  = atm.ro
    vsomi = atm.va
    mld   = -10000
    
 
    for NMach in np.arange(0.65,MMO+0.01,0.01):
        ecruise = oswaldf(NMach, arw, phi14, afilam, tcmed, nedebasa)
        # Long-range lift coefficient
        vcruzi  = NMach*vsomi
        bw      = np.sqrt(arw*sw) # wingspan
        CD0     = cd0_Torenbeek(NMach,sw,bw,wMAC,tcmed,df,Hft,Swet_tot)
        cl_long = masscruzi*9.81/(0.50*rhoi*sw*vcruzi*vcruzi)
        #cdw     = cdwave(NMach,cl_long,phi14,tcmed) # wave drag
        #CDw=CDW_DELFT(NMach,tcmed,cl_long,phi14,afilam,arw)
        CDw=CDW_SHEVELL(phi14,MMO,NMach)
        k       = 1/(np.pi*arw*ecruise)
        cd      = CD0 + k*(cl_long**2) + CDw
        mldcalc = NMach*cl_long/cd
        #
        if mldcalc > mld:
            mld       = mldcalc
            Mach_calc = NMach
        #     Machmax = NMach
            ct=TSFC(ctref,Href,Mref,BPR,Hft,NMach)
            masfrac   = np.exp((rangem*cd*ct)/(3600*cl_long*vcruzi))
            massfin   = masscruzi/masfrac
            mcombc    = masscruzi-massfin 
            time_cru  = rangem/(3600*Mach_calc*vsomi)  # [h]
            
        # for
    #fprintf(' \n Machmax: #4.2f L/D max : #5.2f \n', Machmax, mld/Machmax)

    # function

    return(mcombc,Mach_calc,time_cru)
def test_h_slice(atm, h, func, fname):
    lat_range = (-90, 90)
    lon_range = (0, 360)
    atm = atmosphere.atmosphere("file.anl")
    lon_range = np.linspace(atm.lon_min, atm.lon_max,
                            2 * (atm.lon_max - atm.lon_min + 1))
    lat_range = np.linspace(atm.lat_min, atm.lat_max,
                            2 * (atm.lat_max - atm.lat_min + 1))
    nx = len(lat_range)
    ny = len(lon_range)
    data = np.zeros((nx, ny))

    for i in range(len(lat_range)):
        for j in range(len(lon_range)):
            data[i][j] = func(lat_range[i], lon_range[j], h)

    fig, ax = plt.subplots(1, 1)
    P = ax.pcolormesh(lon_range, lat_range, data)
    m = Basemap(projection='cyl', llcrnrlat=-90,urcrnrlat=90,\
                llcrnrlon=0,urcrnrlon=360)
    m.drawcoastlines()
    fig.savefig(fname, dpi=300)
Esempio n. 9
0
def cl_max_2d(mach, airport_elevation, airfoil_names, airfoil_chords):
    # Constants declaration
    ft2m = 0.3048
    m2ft = 1. / ft2m
    hp = airport_elevation
    ISADEV = 0
    flagsuc = 0  # success flag, initially ok

    atm = atmosphere(hp, ISADEV)

    airfoils = {1: {}, 2: {}, 3: {}}

    for i in range(len(airfoils)):
        j = i + 1
        airfoils[j]['name'] = airfoil_names[i]
        airfoils[j]['chord'] = airfoil_chords[i]
        airfoils[j]['reynolds'] = str(
            (atm.ro * mach * atm.va * airfoil_chords[i]) / atm.visc)

    #--------------------------------------------------------------------------
    # reynolds   = atm.ro*mach*atm.va/mi

    aoa_ini = '0'
    aoa_fin = '20'
    delta_aoa = '1'

    for i in airfoils:
        airfoil = i

        airfoil_name = airfoils[airfoil]['name']
        mach = str(mach)
        reynolds = airfoils[airfoil]['reynolds']

        Cl_max, _, _, _, _, _ = rxfoil(airfoil_name, reynolds, mach, aoa_ini,
                                       aoa_fin, delta_aoa)
        airfoils[airfoil]['Clmax'] = Cl_max

    return (airfoils)
def test_orog():
    lat_range = (-90, 90)
    lon_range = (0, 360)
    now = datetime.now()
    hr = 0
    date_hr = "%d%02d%02d%02d" % (now.year, now.month, now.day, hr)
    #atmosphere.atmosphere.download_file(lat_range, lon_range, date_hr, "file.anl")
    atm = atmosphere.atmosphere("file.anl")
    lon_range = np.linspace(atm.lon_min, atm.lon_max,
                            atm.lon_max - atm.lon_min + 1)
    lat_range = np.linspace(atm.lat_min, atm.lat_max,
                            atm.lat_max - atm.lat_min + 1)
    nx = len(lat_range)
    ny = len(lon_range)
    ground = np.zeros((nx, ny))
    for i in range(len(lat_range)):
        for j in range(len(lon_range)):
            ground[i][j] = atm.get_orog(lat_range[i], lon_range[j])
    fig, ax = plt.subplots(1, 1)
    P = ax.pcolormesh(lon_range, lat_range, ground)
    m = Basemap(projection='cyl', llcrnrlat=-90,urcrnrlat=90,\
                llcrnrlon=0,urcrnrlon=360)
    m.drawcoastlines()
    fig.savefig("orog.png", dpi=300)
                           bflap, FusDiam, AirplaneCLmaxTakeo, mtow * ftakeoff,
                           vt['S'], vt['sweep'], ediam, ebypass,
                           dflecflaptakeoff, k_ind_inc, Swet_tot)
#
flag2seg = 0
if max(TW_2seg_req) > ToW_2seg:
    flag2seg = 1  # if TW_2seg
#------------------ End 2nd segment climb ---------------------------------
#------------------ Fuel storage check ------------------------------------
flagfuel = 0

if mfuel > wingfuelcapacity_kg:
    flagfuel = 1  # if TW_2seg
#------------------ End fuel storage check --------------------------------
#----------------- Balanced field length ----------------------------------
atm = atmosphere(AirportElevation * m2ft, 0)
rho = atm.ro  # densidade [kg/m�]
sigma = rho / 1.225
CL2 = AirplaneCLmaxTakeo / 1.44
V2 = np.sqrt((mtow * ftakeoff * g) / (0.50 * rho * wS))
q = (1 / 2) * rho * V2 * V2  # Dynamic pressure
CDi = k_ind_inc * (CL2**2)
CD0 = cd0_Torenbeek(0.20, wS, bW, wMAC, tcmed, FusDiam,
                    AirportElevation * m2ft, Swet_tot)
dcdflapetakeoff = Drag_flap(dflecflaptakeoff, bflap)
dcdrudder = 0.0020 * np.cos(rad * VTSweep) * (VTArea / wS)
dcdwindmilli = CDWINDMILLTOREN(0.20, ediam, ebypass) / wS
#dcdLDG           = DCD_LDG(mtow,wS,dflecflaptakeoff,dflecflapland)
CD2 = CD0 + CDi + dcdflapetakeoff + dcdrudder + dcdwindmilli
hto = 35 * ft2m
DSTO = 200
def size_ht(HTarea, HTAR, HTTR, PHT, wS, wSweep14, lf, vtSweepLE, vtct, vtc0,
            vtb, htac_rel, Mach, Ceiling):

    #
    rad = np.pi / 180
    m22ft2 = (1 / 0.3048)**2
    kt2ms = 1 / 1.943844  # [kt] para [m/s]

    ht = {}
    ht['S'] = HTarea
    ht['sweep'] = wSweep14 + 5
    ht['AR'] = HTAR  # alongamento EH
    ht['TR'] = HTTR  # Afilamento EH
    ht['tcroot'] = 0.10  # [#]espessura relativa raiz
    ht['tctip'] = 0.10  # [#]espessura relativa ponta
    ht['tcmed'] = (ht['tcroot'] + ht['tctip']) / 2  # [#]espessura media
    ht['Sh_SW'] = ht['S'] / wS  # rela�ao de areas
    ht['et'] = 0  # torcao EH

    if PHT == 1:
        ht['sweepLE'] = 1 / rad * (np.arctan(
            np.tan(rad * ht['sweep']) + 1 / ht['AR'] * (1 - ht['TR']) /
            (1 + ht['TR'])))  # [�] enflechamento bordo de ataque
        ht['sweepC2'] = 1 / rad * (np.arctan(
            np.tan(rad * ht['sweep']) - 1 / ht['AR'] * (1 - ht['TR']) /
            (1 + ht['TR'])))  # [�] enflechamento C/2
        ht['sweepTE'] = 1 / rad * (np.arctan(
            np.tan(rad * ht['sweep']) - 3 / ht['AR'] * (1 - ht['TR']) /
            (1 + ht['TR'])))  # [�] enflechamento bordo de fuga
        ht['b'] = sqrt(ht['AR'] * ht['S'])  # evergadura EH
        ht['c0'] = 2 * ht['S'] / (ht['b'] * (1 + ht['TR']))  # corda de centro
        ht['ct'] = ht['TR'] * ht['c0']  # corda na ponta
        ht['di'] = 3
    else:
        ht['c0'] = vtct
        ht['ct'] = ht['TR'] * ht['c0']
        ht['b'] = 2 * ht['S'] / (ht['ct'] + ht['c0'])
        ht['AR'] = ht['b']**2 / ht['S']
        ht['di'] = -2  # if "T" config a negative dihedral angle to help relaxe  lateral stability
        ht['sweepLE'] = 1 / rad * (np.arctan(
            np.tan(rad * ht['sweep']) + 1 / ht['AR'] * (1 - ht['TR']) /
            (1 + ht['TR'])))  # [�] enflechamento bordo de ataque
        ht['sweepC2'] = 1 / rad * (np.arctan(
            np.tan(rad * ht['sweep']) - 1 / ht['AR'] * (1 - ht['TR']) /
            (1 + ht['TR'])))  # [�] enflechamento C/2
        ht['sweepTE'] = 1 / rad * (np.arctan(
            np.tan(rad * ht['sweep']) - 3 / ht['AR'] * (1 - ht['TR']) /
            (1 + ht['TR'])))  # [�] enflechamento bordo de fuga

    # corda da ponta
    ht['mgc'] = ht['S'] / ht['b']  # mgc
    ht['mac'] = 2 / 3 * ht['c0'] * (1 + ht['TR'] + ht['TR']**2) / (
        1 + ht['TR'])  # mean aerodynamic chord
    ht['ymac'] = ht['b'] / 6 * (1 + 2 * ht['TR']) / (1 + ht['TR'])
    #
    ######################### HT Wetted area ######################################
    tau = ht['tcroot'] / ht['tctip']
    #ht.thicknessavg = ht['tcmed']*0.50*(ht['c0']+ht['ct'])
    ht['Swet'] = 2. * ht['S'] * (1 + 0.25 * ht['tcroot'] * (1 +
                                                            (tau * ht['TR'])) /
                                 (1 + ht['TR']))  # [m2]
    # HT aerodynamic center
    if PHT == 1:
        ht['xac'] = (0.92 * lf - ht['c0'] +
                     ht['ymac'] * np.tan(rad * ht['sweepLE']) +
                     htac_rel * ht['mac'])
    else:
        ht['xac'] = 0.95 * lf - vtc0 + vtb * np.tan(
            rad * vtSweepLE) + htac_rel * ht['mac'] + ht['ymac'] * np.tan(
                rad * ht['sweepLE'])

    ## EMPENAGEM HORIZONTAL (HORIZONTAL TAIL)
    atm = atmosphere(Ceiling, 0)  # propriedades da atmosfera
    va = atm.va  # velocidade do som [m/s]
    sigma = atm.sigma
    vc = Mach * va  # velocidade de cruzeiro meta, verdadeira [m/s]
    vckeas = vc * sigma**0.5 / kt2ms  # velocidade de cruzeiro meta [KEAS]
    vdkeas = 1.25 * vckeas
    kh = 1.1  # empenagem horizontal movel
    prod1 = 3.81 * (((ht['S'] * m22ft2)**0.2) * vdkeas)  # termo 1
    prod2 = (1000 * (np.cos(ht['sweepC2'] * rad))**0.5)  # termo 2
    prodf = prod1 / prod2  # termo 3
    ht['weight'] = 1.25 * kh * (ht['S'] * m22ft2) * (prodf - 0.287)

    return (ht)
    fig, ax = plt.subplots(1, 1)
    ax.plot(cont_x, cont_P)
    ax.plot(discrete_x, discrete_P, ".")
    ax.grid()
    ax.set_facecolor((0.1, 0.1, 0.1))
    ax.set_xlabel("lon (deg)")
    ax.set_ylabel("Pressure (Pa)")
    fig.savefig(folder + "/P_vs_lon.png", dpi=300)


#now = datetime.now()
#hr = 0
#date_hr = "%d%02d%02d%02d" % (now.year, now.month, now.day, hr)
#atmosphere.atmosphere.download_file(lat_range, lon_range, date_hr, "file.anl")
atm = atmosphere.atmosphere("file.anl")
lat = 34.0
lon = 180. - 106
#print(atm.lat_min, atm.lat_max)
#print(atm.lon_min, atm.lon_max)

# test_var_interp(atm, atm.u_ar, atm.get_u, lat, lon, 2000, "u_imgs")
# test_var_interp(atm, atm.v_ar, atm.get_v, lat, lon, 2000, "v_imgs")
# test_var_interp(atm, atm.T_ar, atm.get_T, lat, lon, 2000, "T_imgs")
# test_P_interp(atm, lat, lon, 2000, "P_interp")

#test_h_slice(atm, 5000, atm.get_P, "slices/P_slice.png")
#test_h_slice(atm, 5000, atm.get_u, "slices/u_slice.png")
#test_h_slice(atm, 5000, atm.get_v, "slices/v_slice.png")
#test_h_slice(atm, 5000, atm.get_T, "slices/T_slice.png")
Esempio n. 14
0
def input_fpwb(M,AirportElevation,
    lf,lco,lcab,xle,wS,enf,wingb,diedro,wMAC,
    c0,cr,cq,ct,etabreak,FusDiam,xuroot,xlroot,ylroot,yuroot,
    xukink,xlkink,ylkink,yukink,xutip,xltip,yutip,yltip,ir,iq,it):

    ## Constantes
    rad     = np.pi/180
    ft2m    = 0.3048
    m2ft    = 1./ft2m
    ##
    nuroot = len(xuroot)
    nlroot = len(xlroot)
    nukink = len(xukink)
    nlkink = len(xlkink)
    nutip  = len(xutip)
    nltip  = len(xltip)
    ## 
    ise   = 1. # ise - Control parameter for the nonisentropic correction. # ISE=1. - the nonisentropic correction is used # ISE=0. - no correction
    order = 2. # order - order of the artificial dissipation in the supersonic zones
    #   rchord=chord at wing-fuselage intersection#
    filename = sys.argv[0]

    file_path = os.path.abspath(filename+"/..")
    # file_path = 'c:\\Users\\aarc8\\Documents\\Github\\GIT_IAANDOCAC\\IAANDOCAC-aircraft-framework\\aircraft famework\\framework Bento\\'
    extensions = ('.ps', '.out','.pl4','.blp','.sav','.inp')
    filelist = [ f for f in os.listdir(file_path) if f.endswith(extensions) ]
    for f in filelist:
        os.remove(os.path.join(file_path, f))

    largfus         = 1.03*FusDiam/2
    wingb2          = wingb/2
    dist_quebra     = (wingb2)*etabreak
    raio            = FusDiam/2
    YE0             = raio*0.005 # distancia verticla da asa na linha de centro da fuselagem
    #
    if dist_quebra < largfus:   
        dist_quebra    = 1.15*largfus


    # Geracao de secao circular da fuselagem
    Nupp = 20
    #Secao circular
    yc=[]
    zc=[]
    dteta = np.pi/(2*Nupp-1)

    for j in range(0,2*Nupp):
        teta= (j)*dteta
        yc1=raio*np.cos(teta)
        yc.append(yc1)
        zc1=raio*np.sin(teta)
        zc.append(zc1)

    yc = np.flip(yc)


    #
    minespintra=min(ylroot)
    distv=(FusDiam/2)*np.sin(rad*diedro)
    d1=-1.1*FusDiam/2-minespintra*c0+distv
    if (d1+minespintra*c0) < -0.95*FusDiam/2:
        ylew = -0.94*FusDiam/2 + distv - minespintra*c0
    else:
        ylew=-1.1*FusDiam/2-minespintra*c0

    # Secao comprida entre o inicio e o fim da asa
    # 
    zw = []
    yw = []

    zw.append(0.0)
    yw.append(-1.1*raio)

    zw.append(raio/4)
    yw.append(-1.1*raio)

    zw.append(raio/2)
    yw.append(-1.1*raio)

    zw.append(0.95*raio)
    yw.append(-raio)

    zw.append(+raio)
    yw.append(-0.95*raio)

    zw.append(+raio)
    yw.append(-0.90*raio)

    zw.append(+raio)
    yw.append(-0.50*raio)

    zw.append(+raio)
    yw.append(0.)
    dteta=np.pi/2/Nupp

    for j in range(Nupp):
        teta    = (j+1)*dteta
        yw1 = raio*np.sin(teta)
        yw.append(yw1)
        zw1 = raio*np.cos(teta)
        zw.append(zw1)

    # Secao 1 da fuselagem com carenagem antes da asa
    teta1=20*rad
    y1 =-raio*np.sin(teta1)
    z1 = raio*np.cos(teta1)

    zwf1 = []
    ywf1 = []
    zwf1.append(0.0)
    ywf1.append(-raio)

    zwf1.append(z1/4)
    ywf1.append(-raio)

    zwf1.append(z1/2)
    ywf1.append(-raio)

    zwf1.append(0.90*z1)
    ywf1.append(-0.95*raio)

    zwf1.append(+z1)
    ywf1.append(-0.85*raio)

    ywf1.append(0.50*(+y1-0.95*raio))
    zwf1.append(z1)

    zwf1.append(+z1)
    ywf1.append(1.1*y1)

    zwf1.append(+z1)
    ywf1.append(y1)

    jcount  = 8

    dteta        = (np.pi/2+teta1)/Nupp

    
    for j in frange((-teta1+dteta),np.pi/2,dteta):
        jcount       = jcount + 1
        ywf11= raio*np.sin(j)
        ywf1.append(ywf11)
        zwf11 = raio*np.cos(j)
        zwf1.append(zwf11)


    #plot(zwf1,ywf1,'-bo')
    #hold on

    #
    # Secao 2 da fuselagem com carenagem antes da asa
    #
    teta1=30*rad
    teta2=60*rad
    npontos=10
    dteta = teta1/(npontos-1)

    ywf = []
    zwf = []
    for j in frange(1,npontos,1):
        ang=(j-1)*dteta
        ywf_aux= -raio*np.cos(ang)
        ywf.append(ywf_aux)
        zwf_aux= +raio*np.sin(ang)
        zwf.append(zwf_aux)


    y1 = -raio*np.cos(teta1)
    y2 = -raio*np.cos(teta2)
    #z1 = raio*sin(teta1)
    z2 = raio*np.sin(teta2)
    ymed = 0.50*(y1+y2)
    #zmed = 0.50*(z1+z2)
    ywf.append(y1-0.05*ymed)
    zwf.append(0.90*z2)
    ywf.append(y1-0.150*ymed)
    zwf.append(0.97*z2)

    npi=2*npontos -(npontos+3)+1
    dteta = teta1/(npi-1)

    for j in frange((npontos+3),2*npontos,1):
        ang=teta2+(j-(npontos+3))*dteta
        #angg=ang/rad
        ywf_aux=-raio*np.cos(ang)
        ywf.append(ywf_aux)
        zwf_aux=+raio*np.sin(ang)
        zwf.append(zwf_aux)

    teta3 =np.pi/2
    dteta=teta3/npontos
    for j in frange(1,npontos,1):
        ang=j*dteta
        ywf_aux=raio*np.sin(ang)
        ywf.append(ywf_aux)
        zwf_aux=raio*np.cos(ang)
        zwf.append(zwf_aux)

    #plot(zwf,ywf,'--r+')
    #
    # Secao 2 da fuselagem com carenagem antes da asa
    #
    teta1=40*rad
    teta2=55*rad
    npontos=12
    dteta = teta1/(npontos-1)

    ywf2 = []
    zwf2 = []
    for j in frange(1,npontos,1):
        ang=(j-1)*dteta
        ywf2_aux= -raio*np.cos(ang)
        ywf2.append(ywf2_aux)
        zwf2_aux= +raio*np.sin(ang)
        zwf2.append(zwf2_aux)


    y1 = -raio*np.cos(teta1)
    y2 = -raio*np.cos(teta2)
    #z1 = raio*sin(teta1)
    z2 = raio*np.sin(teta2)
    ymed = 0.50*(y1+y2)
    #zmed = 0.50*(z1+z2)
    ywf2.append(y1-0.05*ymed)
    zwf2.append(0.90*z2)
    ywf2.append(y1-0.150*ymed)
    zwf2.append(0.97*z2)

    npi=2*npontos -(npontos+3)+1
    dteta = teta1/(npi-1)
    for j in frange((npontos+3),2*npontos,1):
        ang=teta2+(j-(npontos+3))*dteta
        #angg=ang/rad
        ywf2_aux=-raio*np.cos(ang)
        ywf2.append(ywf2_aux)
        zwf2_aux=+raio*np.sin(ang)
        zwf2.append(zwf2_aux)

    teta3 =np.pi/2
    dteta=teta3/npontos
    for j in frange(1,npontos,1):
        ang=j*dteta
        ywf2_aux=raio*np.sin(ang)
        ywf2.append(ywf2_aux)
        zwf2_aux=raio*np.cos(ang)
        zwf2.append(zwf2_aux)

    # ****** Preparacao da geracao dos dois arquivos com angulo de ataque 
    #         diferentes cada um  *********************************************
    for jj in range(1,3):
    #
        if jj == 1:
                # gera arquivo # 1 para calculo do clmax
            CL     = 0.5
            Ataque = 3
            FCONT  = 0. # start from scratch
            atm    = atmosphere(AirportElevation*m2ft,0)

            TAE    = atm.TAE # temperatura [K]
            T8     = TAE
            ro     = atm.ro # densidade [Kg/m�]
            va     = atm.va # velocidade do som [m/s]
        # ***** air viscosity (begin)******
            mi0    = 18.27E-06
            Tzero  = 291.15 # Reference temperature (15 graus celsius)
            Ceh    = 120 # C = Sutherland's constant for the gaseous material in question
            mi     = mi0*((TAE+Ceh)/(Tzero+Ceh))*((TAE/Tzero)**1.5)
            vel    = va*M
            rey    = ro*vel*wMAC/mi
            fid    = open('fpwbclm1.inp','w+')
        elif jj == 2:
            # gera arquivo # 2 para calculo do CLmax
            CL=0.75
            Ataque = 5
            FCONT =0. # =1 ==>start from previous calculation

            atm=atmosphere(AirportElevation*m2ft,0)
            TAE=atm.TAE # temperatura [K]
            T8 = TAE
            ro=atm.ro # densidade [Kg/m�]
            va=atm.va # velocidade do som [m/s]
        # ***** air viscosity (begin)******
            mi0=18.27E-06
            Tzero=291.15 # Reference temperature
            Ceh= 120 # C = Sutherland's constant for the gaseous material in question
            mi=mi0*((TAE+Ceh)/(Tzero+Ceh))*((TAE/Tzero)**1.5)
            vel=va*M
            rey=ro*vel*wMAC/mi
            fid = open('fpwbclm2.inp',"w")

        # Stations for viscous calculation
        nvisc_i=4
        nvisc_e=5
        stavi=largfus/wingb2 + 0.0125
        stabreak=dist_quebra/wingb2 
        zvisc_internal=np.linspace(stavi,stabreak,nvisc_i)
        zvisc_external=np.linspace(stabreak+0.1,1.,nvisc_e)
        zvisc = np.concatenate([zvisc_internal,zvisc_external])
        nvisc=nvisc_i+nvisc_e
        #nvisc=double(nvisc)
        
        fid.write('          AVAER FULL POTENTIAL ANALYSIS                                           \n')
        fid.write('    NX   ><   NY   ><   NZ   ><   NT   ><  FCONT >                                \n')
        fid.write('    48.        12.        10.     5.       %2.0f                                 \n' % FCONT)
        fid.write('  FPICT1 >< FPICT2 >< FPICT3 >< FPICT4 >< FPICT5 ><        ><        >< tecplot>  \n')
        fid.write('    0.         0.        0.        0.       0.0                           0.      \n')
        fid.write('   XMIN  ><  XMAX  ><  YMIN  ><  YMAX  ><  ZMIN  ><  ZMAX  >                      \n')
        fid.write('    -.1       1.7      -.9        .9       .0        2.7                          \n')
        fid.write('    EX   ><   EY   ><   EZ   >                                                    \n')
        fid.write('   -5.        5.        10.                                                       \n')
        fid.write('    NP   ><  ETAE  ><   T8   ><   PR   ><   PRT  ><   RRR  ><   VGL  ><   VGT  >  \n')
        fid.write('    21.       4.      %4.0f      .753       .90        1.      1.26      1.26     \n' % T8)
        fid.write('    NTR  ><  AL_CL ><   CL   >< DCL/DA >                                          \n')
        fid.write(' %6.1f        0.       %4.2f     0.40                                             \n' % (nvisc, CL))
        fid.write('<   Z    ><  XTRU  ><  XTRL  >                                                    \n')
        for jvisc in range(nvisc):
            fid.write(' %9.4f      0.05      0.05    \n' % zvisc[jvisc]) 
        fid.write('    NDF  ><   NVB  >< CFXMIN ><  F_LK  >                                          \n')
        fid.write('    5.        1.0       -5.      0.0                                              \n')
        fid.write('  FPRIN0 >< FPRIN1 >< FPRIN2 >< FPRINB >                                          \n')
        fid.write('    1.        -9.      -9.       -2.                                              \n')
        fid.write('  FPLOT1 >< FPLOT2 >< FPLOT3 >< FPLOT4 >< FPLOT5 >< FPLOT6 >< FPLOT7 >< FPLOT8 >  \n')
        fid.write('    1.        1.        1.        1.        1.        1.        2.        2.      \n')
        fid.write('  CPMINW >< CPMINF >                                                              \n')
        fid.write('    -2.      -1.6                                                                 \n')
        fid.write('< NZOUT  >                                                                        \n')
        fid.write('    6.                                                                            \n')
        fid.write('< ZCPOUT >                                                                        \n')
        fid.write('   0.150                                                                          \n')
        fid.write('   0.250                                                                          \n')
        fid.write('   0.415                                                                          \n')
        fid.write('   0.500                                                                          \n')
        fid.write('   0.700                                                                          \n')
        fid.write('   0.950                                                                          \n')
        fid.write('  NCPOUT >                                                                        \n')
        fid.write('    20.                                                                           \n')
        fid.write('   CPOUT >                                                                        \n')
        fid.write('   -1.4                                                                           \n')
        fid.write('   -1.3                                                                           \n')
        fid.write('   -1.2                                                                           \n')
        fid.write('   -1.1                                                                           \n')
        fid.write('   -1.0                                                                           \n')
        fid.write('   -.9                                                                            \n')
        fid.write('   -.8                                                                            \n')
        fid.write('   -.7                                                                            \n')
        fid.write('   -.6                                                                            \n')
        fid.write('   -.5                                                                            \n')
        fid.write('   -.4                                                                            \n')
        fid.write('   -.3                                                                            \n')
        fid.write('   -.2                                                                            \n')
        fid.write('   -.1                                                                            \n')
        fid.write('    .0                                                                            \n')
        fid.write('    .1                                                                            \n')
        fid.write('    .2                                                                            \n')
        fid.write('    .3                                                                            \n')
        fid.write('    .4                                                                            \n')
        fid.write('    .5                                                                            \n')
        fid.write('    NIT  ><   MIT  ><   P1   ><   P2   ><   PL   ><   PH   ><   NLH  ><  FHALF >  \n')
        fid.write('    30.       30.      1.3       1.00      .7         1.5        3.         1.  \n')
        fid.write('    NBL  >                                                                      \n')
        fid.write('     4.                                                                         \n')
        fid.write('   NITBL ><   PB   ><  PBIV  >                                                  \n')
        fid.write('     6.       .8                                                                \n')
        fid.write('    12.       .8                                                                \n')
        fid.write('    18.       .8                                                                \n')
        fid.write('    24.       .8                                                                \n')
        fid.write('    NIT  ><   MIT  ><   P1   ><   P2   ><   PL   ><   PH   ><   NLH  ><  FHALF >\n')
        fid.write('    40.       30.      1.2       1.00      .7         1.5        4.         1.  \n')
        fid.write('    NBL  >                                                                      \n')
        fid.write('     6.                                                                         \n')
        fid.write('   NITBL ><   PB   ><  PBIV  >                                                  \n')
        fid.write('     6.       .7                                                                \n')
        fid.write('    12.       .7                                                                \n')
        fid.write('    18.       .7                                                                \n')
        fid.write('    24.       .7                                                                \n')
        fid.write('    30.       .7                                                                \n')
        fid.write('    36.       .7                                                                \n')
        fid.write('    NIT  ><   MIT  ><   P1   ><   P2   ><   PL   ><   PH   ><   NLH  ><  FHALF >\n')
        fid.write('    36.       30.      1.0       1.001     .7         1.5        5.         0.  \n')
        fid.write('    NBL  >                                                                      \n')
        fid.write('     5.                                                                         \n')
        fid.write('   NITBL ><   PB   ><  PBIV  >                                                  \n')
        fid.write('     6.       .55                                                                \n')
        fid.write('    12.       .55                                                                \n')
        fid.write('    18.       .55                                                                \n')
        fid.write('    24.       .55                                                               \n')
        fid.write('    30.       .55                                                               \n')
        fid.write('<  MACH  ><  ALFA  ><   RE   ><   CAX  ><  SWING ><   SE   >< ORDER  >          \n')
        fid.write('%8.3f%10.3f%10.0f.%10.3f%10.4f%10.4f%10.4f\n'% (M ,Ataque, rey, wMAC, wS/2, ise, order))
        fid.write('<  NSEC  >< PZROOT ><  PZTIP ><   PXLE ><   PXTE ><   PYTE ><   PZA  ><   PZB  >\n')
        fid.write('  4.00000   0.15000   0.25000   0.65000   0.65000   0.80000   0.00000   0.00000 \n')

        # ROOT SIMMETRY %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        fid.write('<    Z   ><   XLE  ><   YLE  ><  CHORD ><  THICK ><  ALPHA ><  FSEC  >          \n')
        fid.write('%9.4f %10.5f%10.5f%10.5f%10.5f%10.5f%10.5f\n' % (0,0,YE0+largfus*np.tan(rad*diedro),c0,1,ir,1))
        fid.write('<  YSYM  ><   NU   ><   NL   >                                                  \n')
        fid.write('%10.5f%10.5f%10.5f\n' % (0,nuroot,nlroot))
        fid.write(' <  XSING ><  YSING ><  TRAIL ><  SLOPT >\n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (0.00921,0,7.16234,-0.05857))
        fid.write(' <   XU   ><   YU   >\n')
        for j in range(len(xuroot)):
            fid.write('%10.5f%10.5f\n' % (xuroot[j], yuroot[j])) 
        fid.write(' <   XL   ><   YL   >\n')
        for j in range(len(xlroot)):
            fid.write('%10.5f%10.5f\n' % (xlroot[j], ylroot[j]))
        
        # ROOT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        fid.write('<    Z   ><   XLE  ><   YLE  ><  CHORD ><  THICK ><  ALPHA ><  FSEC  >          \n')
        fid.write('%9.4f %10.5f%10.5f%10.5f%10.5f%10.5f%10.5f\n' % (largfus,largfus*np.tan(rad*enf),YE0+largfus*np.tan(rad*diedro),cr,1,ir,1))
        fid.write('<  YSYM  ><   NU   ><   NL   >                                                  \n')
        fid.write('%10.5f%10.5f%10.5f\n' % (0,nuroot,nlroot))
        fid.write(' <  XSING ><  YSING ><  TRAIL ><  SLOPT >\n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (0.00921,0,7.16234,-0.05857))
        fid.write('<   XU   ><   YU   >\n')
        for j in range(len(xuroot)):
            fid.write('%10.5f%10.5f\n' % (xuroot[j], yuroot[j])) 
        fid.write(' <   XL   ><   YL   >\n')
        for j in range(len(xlroot)):
            fid.write('%10.5f%10.5f\n' % (xlroot[j], ylroot[j]))

        # % BREAK %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        fid.write('<    Z   ><   XLE  ><   YLE  ><  CHORD ><  THICK ><  ALPHA ><  FSEC  >          \n')
        fid.write('%9.4f %10.5f%10.5f%10.5f%10.5f%10.5f%10.5f\n' % (dist_quebra,(np.tan(rad*enf))*dist_quebra,YE0+dist_quebra*np.tan(rad*diedro),cq,1,iq,1))
        fid.write('<  YSYM  ><   NU   ><   NL   >                                                  \n')
        fid.write('%10.5f%10.5f%10.5f\n' % (0,nukink,nlkink))
        fid.write(' <  XSING ><  YSING ><  TRAIL ><  SLOPT >\n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (0.00800,0.00300,5.14083,-0.09346))
        fid.write(' <   XU   ><   YU   >\n')
        for j in range(len(xukink)):
            fid.write('%10.5f%10.5f\n' % (xukink[j], yukink[j])) 
        fid.write(' <   XL   ><   YL   >\n')
        for j in range(len(xlkink)):
            fid.write('%10.5f%10.5f\n' % (xlkink[j], ylkink[j]))

        # % TIP %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        fid.write('<    Z   ><   XLE  ><   YLE  ><  CHORD ><  THICK ><  ALPHA ><  FSEC  >          \n')
        fid.write('%9.4f %10.5f%10.5f%10.5f%10.5f%10.5f%10.5f\n' % (wingb2,(np.tan(rad*enf))*(wingb2),YE0+wingb2*np.tan(rad*diedro),ct,1,it,1))
        fid.write('<  YSYM  ><   NU   ><   NL   >                                                  \n')
        fid.write('%10.5f%10.5f%10.5f\n' % (0,nutip,nltip))
        fid.write(' <  XSING ><  YSING ><  TRAIL ><  SLOPT >\n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (0.00249,0,4.39914,-0.12401))
        fid.write('<   XU   ><   YU   >\n')
        for j in range(len(xutip)):
            fid.write('%10.5f%10.5f\n' % (xutip[j], yutip[j])) 
        fid.write(' <   XL   ><   YL   >\n')
        for j in range(len(xltip)):
            fid.write('%10.5f%10.5f\n' % (xltip[j], yltip[j]))


        # % DADOS DA FUSELAGEM %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        fid.write('<  xlew  ><  ylew  >                                                            \n')
        fid.write('  %5.3f     %5.3f \n' % (xle,ylew))
        fid.write('<  XLEF  ><  YLEF  ><  XTEF  ><  YTEF  ><  XTEF0 ><  ANSF  >                    \n')
        fid.write('  0.00000  -0.91662    %5.4f   %5.4f    %5.4f    26.0\n' % (lf,FusDiam/2-0.5,lf-0.25))
        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  1 -                       \n')
        fid.write(' 0.40000   -0.83153   0.43867   1.00000\n')
        fid.write('<   NT   >                                                                      \n')
        fid.write('  53.00000\n')
        fid.write('<    Y   ><    Z   >                                                            \n')
        fid.write(' -1.27021  0.00000\n')
        fid.write(' -1.27004  0.01507\n')
        fid.write(' -1.26867  0.04518\n')
        fid.write(' -1.26593  0.07519\n')
        fid.write(' -1.26183  0.10504\n')
        fid.write(' -1.25634  0.13468\n')
        fid.write(' -1.24948  0.16402\n')
        fid.write(' -1.24124  0.19301\n')
        fid.write(' -1.23160  0.22157\n')
        fid.write(' -1.22057  0.24961\n')
        fid.write(' -1.20814  0.27707\n')
        fid.write(' -1.19431  0.30384\n')
        fid.write(' -1.17908  0.32985\n')
        fid.write(' -1.16245  0.35498\n')
        fid.write(' -1.14442  0.37913\n')
        fid.write(' -1.12501  0.40218\n')
        fid.write(' -1.10425  0.42402\n')
        fid.write(' -1.08215  0.44451\n')
        fid.write(' -1.05877  0.46352\n')
        fid.write(' -1.03416  0.48091\n')
        fid.write(' -1.00840  0.49655\n')
        fid.write(' -0.98158  0.51028\n')
        fid.write(' -0.95381  0.52197\n')
        fid.write(' -0.92522  0.53150\n')
        fid.write(' -0.89598  0.53877\n')
        fid.write(' -0.86625  0.54368\n')
        fid.write(' -0.83622  0.54618\n')
        fid.write(' -0.80609  0.54619\n')
        fid.write(' -0.77608  0.54354\n')
        fid.write(' -0.74642  0.53823\n')
        fid.write(' -0.71734  0.53034\n')
        fid.write(' -0.68904  0.52001\n')
        fid.write(' -0.66168  0.50739\n')
        fid.write(' -0.63541  0.49263\n')
        fid.write(' -0.61033  0.47591\n')
        fid.write(' -0.58654  0.45742\n')
        fid.write(' -0.56409  0.43732\n')
        fid.write(' -0.54301  0.41578\n')
        fid.write(' -0.52334  0.39296\n')
        fid.write(' -0.50508  0.36898\n')
        fid.write(' -0.48823  0.34400\n')
        fid.write(' -0.47280  0.31811\n')
        fid.write(' -0.45877  0.29144\n')
        fid.write(' -0.44612  0.26409\n')
        fid.write(' -0.43486  0.23613\n')
        fid.write(' -0.42495  0.20767\n')
        fid.write(' -0.41640  0.17877\n')
        fid.write(' -0.40918  0.14951\n')
        fid.write(' -0.40330  0.11996\n')
        fid.write(' -0.39873  0.09017\n')
        fid.write(' -0.39547  0.06021\n')
        fid.write(' -0.39352  0.03013\n')
        fid.write(' -0.39287  0.00000\n')
        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  2 -                       \n')
        fid.write(' 0.76000   -0.75298   0.63910   1.00000\n')
        fid.write('<   NT   >                                                                      \n')
        fid.write('  38.00000\n')
        fid.write('<    Y   ><    Z   >                                                            \n')
        fid.write(' -1.39209  0.00000\n')
        fid.write(' -1.39094  0.04512\n')
        fid.write(' -1.38586  0.10508\n')
        fid.write(' -1.37672  0.16456\n')
        fid.write(' -1.36350  0.22326\n')
        fid.write(' -1.34622  0.28090\n')
        fid.write(' -1.32488  0.33716\n')
        fid.write(' -1.29949  0.39172\n')
        fid.write(' -1.27008  0.44421\n')
        fid.write(' -1.23669  0.49427\n')
        fid.write(' -1.19940  0.54149\n')
        fid.write(' -1.15830  0.58544\n')
        fid.write(' -1.11357  0.62567\n')
        fid.write(' -1.06539  0.66172\n')
        fid.write(' -1.01407  0.69311\n')
        fid.write(' -0.95995  0.71939\n')
        fid.write(' -0.90348  0.74014\n')
        fid.write(' -0.84519  0.75499\n')
        fid.write(' -0.78566  0.76367\n')
        fid.write(' -0.72554  0.76600\n')
        fid.write(' -0.66557  0.76143\n')
        fid.write(' -0.60655  0.74979\n')
        fid.write(' -0.54928  0.73139\n')
        fid.write(' -0.49442  0.70670\n')
        fid.write(' -0.44252  0.67629\n')
        fid.write(' -0.39397  0.64076\n')
        fid.write(' -0.34906  0.60072\n')
        fid.write(' -0.30796  0.55677\n')
        fid.write(' -0.27080  0.50946\n')
        fid.write(' -0.23761  0.45927\n')
        fid.write(' -0.20841  0.40665\n')
        fid.write(' -0.18319  0.35202\n')
        fid.write(' -0.16192  0.29573\n')
        fid.write(' -0.14458  0.23811\n')
        fid.write(' -0.13112  0.17946\n')
        fid.write(' -0.12154  0.12005\n')
        fid.write(' -0.11579  0.06015\n')
        fid.write(' -0.11388  0.00000\n')
        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  3 -                       \n')
        fid.write(' 1.50500   -0.60064   0.94872   1.00000\n')
        fid.write('<   NT   >                                  \n')                                    
        fid.write('  36.00000\n')
        fid.write('<    Y   ><    Z   >                                                            \n')
        fid.write(' -1.54935 0.00000\n')
        fid.write(' -1.54681 0.07505\n')
        fid.write(' -1.53706 0.16462\n')
        fid.write(' -1.52004 0.25310\n')
        fid.write(' -1.49583 0.33989\n')
        fid.write(' -1.46454 0.42438\n')
        fid.write(' -1.42631 0.50597\n')
        fid.write(' -1.38134 0.58404\n')
        fid.write(' -1.32987 0.65799\n')
        fid.write(' -1.27220 0.72721\n')
        fid.write(' -1.20867 0.79110\n')
        fid.write(' -1.13970 0.84907\n')
        fid.write(' -1.06577 0.90056\n')
        fid.write(' -0.98743 0.94505\n')
        fid.write(' -0.90529 0.98207\n')
        fid.write(' -0.82004 1.01121\n')
        fid.write(' -0.73241 1.03212\n')
        fid.write(' -0.64318 1.04456\n')
        fid.write(' -0.55317 1.04839\n')
        fid.write(' -0.46328 1.04262\n')
        fid.write(' -0.37463 1.02663\n')
        fid.write(' -0.28834 1.00079\n')
        fid.write(' -0.20540 0.96563\n')
        fid.write(' -0.12667 0.92185\n')
        fid.write(' -0.05286 0.87020\n')
        fid.write('  0.01550 0.81152\n')
        fid.write('  0.07797 0.74660\n')
        fid.write('  0.13427 0.67626\n')
        fid.write('  0.18419 0.60125\n')
        fid.write('  0.22758 0.52229\n')
        fid.write('  0.26436 0.44004\n')
        fid.write('  0.29449 0.35512\n')
        fid.write('  0.31793 0.26812\n')
        fid.write('  0.33468 0.17959\n')
        fid.write('  0.34473 0.09004\n')
        fid.write('  0.34808 0.00000\n')
        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  4 -                       \n')
        fid.write('  2.31900  -0.37244   1.259513   1.00000\n')
        fid.write('<   NT   >                                                                      \n')
        fid.write('  44.00000\n')
        fid.write('<    Y   ><    Z   >                                                            \n')
        fid.write(' -1.63195 0.00000\n')
        fid.write(' -1.62595 0.08975\n')
        fid.write(' -1.61332 0.17880\n')
        fid.write(' -1.59419 0.26669\n')
        fid.write(' -1.56876 0.35296\n')
        fid.write(' -1.53719 0.43719\n')
        fid.write(' -1.49970 0.51895\n')
        fid.write(' -1.45650 0.59785\n')
        fid.write(' -1.40782 0.67349\n')
        fid.write(' -1.35392 0.74550\n')
        fid.write(' -1.29506 0.81351\n')
        fid.write(' -1.23150 0.87716\n')
        fid.write(' -1.16356 0.93610\n')
        fid.write(' -1.09154 0.98998\n')
        fid.write(' -1.01577 1.03846\n')
        fid.write(' -0.93710 1.08208\n')
        fid.write(' -0.85616 1.12132\n')
        fid.write(' -0.77315 1.15599\n')
        fid.write(' -0.68831 1.18587\n')
        fid.write(' -0.60158 1.20972\n')
        fid.write(' -0.51329 1.22687\n')
        fid.write(' -0.42393 1.23709\n')
        fid.write(' -0.33405 1.23879\n')
        fid.write(' -0.24444 1.23106\n')
        fid.write(' -0.15583 1.21567\n')
        fid.write(' -0.06879 1.19301\n')
        fid.write('  0.01618 1.16351\n')
        fid.write('  0.09866 1.12763\n')
        fid.write('  0.17829 1.08580\n')
        fid.write('  0.25478 1.03847\n')
        fid.write('  0.32785 0.98602\n')
        fid.write('  0.39729 0.92884\n')
        fid.write('  0.46249 0.86686\n')
        fid.write('  0.52448 0.80168\n')
        fid.write('  0.58315 0.73348\n')
        fid.write('  0.63825 0.66237\n')
        fid.write('  0.68947 0.58843\n')
        fid.write('  0.73643 0.51170\n')
        fid.write('  0.77864 0.43227\n')
        fid.write('  0.81542 0.35019\n')
        fid.write('  0.84589 0.26556\n')
        fid.write('  0.86890 0.17862\n')
        fid.write('  0.88307 0.08982\n')
        fid.write('  0.88707 0.00000\n')


        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  5 -                       \n')
        fid.write('%8.7f %8.7f %8.7f 1.00000\n' % (lco,0.,raio))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n' % len(yc))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(yc)):
            fid.write('%8.7f %8.7f\n' % (yc[j], zc[j]))  

        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  6 -                       \n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (lco+0.10,0.,raio,1.))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n' % (len(yc)))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(yc)):
            fid.write('%8.7f %8.7f\n' % (yc[j], zc[j]))  

        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  7 -                       \n')
        fid.write('%8.7f 0.000000  %8.7f 1.00000\n' % (lco+0.25,raio))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n'  % len(yc))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(yc)):
            fid.write('%8.7f %8.7f\n' % (yc[j], zc[j]))  

        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  8 -                       \n')
        fid.write('%9.8f 0.000000  %8.7f 1.00000\n' % (lco+1.,raio))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n' % (len(yc)))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(yc)):
            fid.write('%8.7f %8.7f\n' % (yc[j], zc[j]))  
        xpos1=max(lco+1.2,xle-1.80)
        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  9 -                       \n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (xpos1,0.,raio,1.0))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n'   % (len(yc))) 
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(yc)):
            fid.write('%8.7f %8.7f\n' % (yc[j], zc[j]))  

        xpos2=max(xpos1+0.2,xle-1.20)
        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  10 -                       \n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (xpos2,0.,raio,1.0))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n' % (len(yc)))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(yc)):
            fid.write('%8.7f %8.7f\n' % (yc[j], zc[j]))  

        ywf2med = 0.50*(max(ywf2)+ min(ywf2))
        radius2 = max(ywf2)-ywf2med

        ywfmed   = 0.50*(max(ywf)+min(ywf))
        radiusf  = max(ywf)-ywfmed

        xpos3=max(xpos2+0.20,xle-1.0)
        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  11 -                       \n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (xpos3,ywfmed,radiusf,1.))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n' % len(ywf))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(ywf)):
            fid.write('%8.7f %8.7f\n' % (ywf[j], zwf[j])) 

        ywf1med   = 0.50*(max(ywf1)+min(ywf1))
        radiusf1  = max(ywf1) - ywf1med

        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  12 -                       \n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (xle-0.50,ywf1med,radiusf1,1.))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n' % len(ywf1))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(ywf1)):
            fid.write('%8.7f %8.7f\n' % (ywf1[j], zwf1[j]))  

        # %fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  11 -                       \n')
        # %fid.write('%8.7f 0.000000  %8.7f 1.00000\n',xle-0.12,raio)
        # %fid.write('<   NT   >                                                                      \n')
        # %fid.write('%8.7f\n',size(yw,2))
        # %fid.write('<    Y   ><    Z   >                                                            \n') 
        # %fid.write('%8.7f %8.7f\n',[ywzw]) 

        ywmed   = 0.50*(max(yw)+min(yw))
        radiusw = max(yw)-ywmed

        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  13 -                       \n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (xle-0.1,ywmed,radiusw,1.))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n' % len(yw))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(yw)):
            fid.write('%8.7f %8.7f\n' % (yw[j], zw[j])) 

        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  14 -                       \n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (xle,ywmed,radiusw,1.))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n' % len(yw))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(yw)):
            fid.write('%8.7f %8.7f\n' % (yw[j], zw[j])) 

        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  15 -                       \n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (xle+c0/4.,ywmed,radiusw,1.))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n' % len(yw))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(yw)):
            fid.write('%8.7f %8.7f\n' % (yw[j], zw[j]))

        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  16 -                       \n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (xle+c0/2.,ywmed,radiusw,1.))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n' % len(yw))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(yw)):
            fid.write('%8.7f %8.7f\n' % (yw[j], zw[j]))

        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  17 -                       \n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (xle+3*c0/4,ywmed,radiusw,1.))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n' % len(yw))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(yw)):
            fid.write('%8.7f %8.7f\n' % (yw[j], zw[j]))

        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  18 -                       \n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (xle+c0+0.20,ywmed,radiusw,1.))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n' % len(yw))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(yw)):
            fid.write('%8.7f %8.7f\n' % (yw[j], zw[j]))

        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  19 -                       \n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (xle+c0+0.80,ywf1med,radiusf1,1.))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n' % len(ywf1))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(ywf1)):
            fid.write('%8.7f %8.7f\n' % (ywf1[j], zwf1[j]))

        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  20 -                       \n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (xle+c0+1.50,ywfmed,radiusf,1.))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n'% len(ywf))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(ywf)):
            fid.write('%8.7f %8.7f\n' % (ywf[j], zwf[j]))

        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  21 -                       \n')
        fid.write('%10.5f%10.5f%10.5f%10.5f\n' % (xle+c0+1.80,ywf2med,radius2,1.))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n' % len(ywf2))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(ywf2)):
            fid.write('%8.7f %8.7f\n' % (ywf2[j], zwf2[j]))

        xpos10=0.50*((xle+c0+1.80)+(lco+lcab))
        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  22 -                       \n')
        fid.write('%8.7f 0.000000  %8.7f 1.00000\n' % (xpos10,raio))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n' % len(yc))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(yc)):
            fid.write('%8.7f %8.7f\n' % (yc[j], zc[j]))

        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  23 -                       \n')
        fid.write('%8.7f 0.000000  %8.7f 1.00000\n' % (lco+lcab,raio))
        fid.write('<   NT   >                                                                      \n')
        fid.write('%8.7f\n' % len(yc))
        fid.write('<    Y   ><    Z   >                                                            \n') 
        for j in range(len(yc)):
            fid.write('%8.7f %8.7f\n' % (yc[j], zc[j]))
        
        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  24 -                       \n')
        fid.write('%8.7f %8.7f %8.7f 1.00000\n' % (lf-0.90,FusDiam/2-0.25,0.25))
        fid.write('<   NT   >                                                                      \n')
        fid.write(' %8.7f\n' % 11.0)
        fid.write('<    Y   ><    Z   >                                                            \n')  
        fid.write('%8.7f 0.00000\n' % (raio-0.50))
        fid.write('%8.7f 0.05000\n' % (raio-0.50))
        fid.write('%8.7f 0.12000\n' % (raio-0.50))
        fid.write('%8.7f 0.12500\n' % (raio-0.45))
        fid.write('%8.7f 0.12500\n' % (raio-0.40))
        fid.write('%8.7f 0.12500\n' % (raio-0.30))
        fid.write('%8.7f 0.12500\n' % (raio-0.25))
        fid.write('%8.7f 0.12500\n' % (raio-0.05))
        fid.write('%8.7f 0.12000\n' % raio)
        fid.write('%8.7f 0.05000\n' % raio)
        fid.write('%8.7f 0.00000\n' % raio)

        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  25 -                       \n')
        fid.write('%8.7f %8.7f %8.7f 1.00000\n' % (lf-0.75,raio-0.25,0.25))
        fid.write('<   NT   >                                                                      \n')
        fid.write(' %8.7f\n' % 11.0)
        fid.write('<    Y   ><    Z   >                                                            \n')  
        fid.write('%8.7f 0.00000\n' % (raio-0.50))
        fid.write('%8.7f 0.05000\n' % (raio-0.50))
        fid.write('%8.7f 0.12000\n' % (raio-0.50))
        fid.write('%8.7f 0.12500\n' % (raio-0.45))
        fid.write('%8.7f 0.12500\n' % (raio-0.40))
        fid.write('%8.7f 0.12500\n' % (raio-0.30))
        fid.write('%8.7f 0.12500\n' % (raio-0.25))
        fid.write('%8.7f 0.12500\n' % (raio-0.05))
        fid.write('%8.7f 0.12000\n' % raio)
        fid.write('%8.7f 0.05000\n' % raio)
        fid.write('%8.7f 0.00000\n' % raio)

        fid.write('<   XF   ><   YF   ><   RF   >< FCONT  >   - section  26 -                       \n')
        fid.write('%8.7f %8.7f %8.7f 1.00000\n' % (lf-0.5,raio-0.25,0.25))
        fid.write('<   NT   >                                                                      \n')
        fid.write(' %8.7f\n' % 11.0)
        fid.write('<    Y   ><    Z   >                                                            \n')  
        fid.write('%8.7f 0.00000\n' % (raio-0.50))
        fid.write('%8.7f 0.05000\n' % (raio-0.50))
        fid.write('%8.7f 0.12000\n' % (raio-0.50))
        fid.write('%8.7f 0.12500\n' % (raio-0.45))
        fid.write('%8.7f 0.12500\n' % (raio-0.40))
        fid.write('%8.7f 0.12500\n' % (raio-0.30))
        fid.write('%8.7f 0.12500\n' % (raio-0.25))
        fid.write('%8.7f 0.12500\n' % (raio-0.05))
        fid.write('%8.7f 0.12000\n' % raio)
        fid.write('%8.7f 0.05000\n' % raio)
        fid.write('%8.7f 0.00000\n' % raio)
        fid.close()

    return()
Esempio n. 15
0
 def editImageLat(self,latmod,Tmod,limb=[0.0]):
     """This only works for negative latitudes to pole.  Need to make northern,southern,straddle + bands.
         latmod is the planetographic latitude that marks the boundary (degrees)
         Tmod is/are the temperature values
         limb are the corresponding b-values"""
     import planet
     import atmosphere
     pyPlanetPath = os.getenv('PYPLANETPATH')
     if pyPlanetPath == None:
         print 'No PYPLANETPATH environment variable'
         pyPlanetPath = './'
     atm = atmosphere.atmosphere('neptune',pyPlanetPath)
     atm.run()
     p = planet.planet('functions')
     bdata = p.bRequest(self.header['b'][0],block=[1,1])
     if len(bdata) != np.size(self.data):
         print 'b-values (%d) do not number the same as the image size (%d)' % (len(bdata),np.size(self.data))
         return 0
     radii = []
     for i in range(len(self.header['radii'])):
         if type(self.header['radii'][i])==float or type(self.header['radii'][i])==int:
             radii.append(self.header['radii'][i])
     rNorm = self.header['rNorm'][0]
     Req = np.max(radii)
     Rpol = np.min(radii)
     f = (Req-Rpol)/Req
     gtype = 'ellipse'
     tip = self.header['aspect'][0]
     tip*=math.pi/180.0
     rotate = self.header['aspect'][1]
     #rotate = -1.0*math.atan(math.tan(rotate*math.pi/180.0)*(1.0-f)**2)
     rotate*=math.pi/180.0
     lat_pg = latmod*math.pi/180.0
     lat_pcmod = math.atan(math.tan(lat_pg)*(1.0-f)**2)
     pixel_modlist = []
     nedit = 0
     if type(Tmod)==float or type(Tmod)==int:
         Tmod = list(Tmod)
     if len(Tmod) != len(limb):
         print 'limb is incorrectly specified'
         return 0
     for i in range(len(bdata)):
         edge, bmod = raypath.__findEdge__(atm,bdata[i],rNorm,tip,rotate,gtype,printdot=False)
         if edge == None:
             continue
         pclat = math.asin( np.dot(edge,raypath.yHat)/np.linalg.norm(edge) )
         delta_lng = math.atan2( np.dot(edge,raypath.xHat), np.dot(edge,raypath.zHat) )
         if pclat > 0.0:
             break
         if pclat < lat_pcmod:
             row = int(float(i) // float(len(self.data)))
             col = i - row*len(self.data)
             pixel_modlist.append([row,col,i])
             nedit+=1
     breakb = 0.96
     if len(Tmod) > 1:
         wherebb = np.where(np.array(limb) < breakb)
         Tfunc3 = interpolate.interp1d(limb[wherebb[0][0]:wherebb[0][-1]+1],Tmod[wherebb[0][0]:wherebb[0][-1]+1],kind=3,bounds_error=False,fill_value=0.0)
         Tfunc1 = interpolate.interp1d(limb,Tmod,kind=1)
     else:
         Tfunc3 = lambda x: Tmod[0]
         Tfunc1 = lambda x: Tmod[0]
     testPlotLimb = False
     if testPlotLimb:
         pltl = np.linspace(limb[0],limb[-1],50)
         pltt = Tfunc3(pltl)
         plt.figure('limbFunction')
         plt.plot(pltl,pltt)
         pltt = Tfunc1(pltl)
         plt.plot(pltl,pltt)
         plt.plot(limb,Tmod,'o')
         math.sqrt(-1.)
     for px in pixel_modlist:
         bval = math.sqrt( bdata[px[2]][0]**2 + bdata[px[2]][1]**2 )
         if bval < limb[0]:
             bval = limb[0]
         elif bval > limb[-1]:
             bval = limb[-1]
         if bval < breakb:
             Tnew = Tfunc3(bval)
         else:
             Tnew = Tfunc1(bval)
         self.data[px[0],px[1]] = Tnew
     return nedit
Esempio n. 16
0
 def editImageLat(self, latmod, Tmod, limb=[0.0]):
     """This only works for negative latitudes to pole.  Need to make northern,southern,straddle + bands.
         latmod is the planetographic latitude that marks the boundary (degrees)
         Tmod is/are the temperature values
         limb are the corresponding b-values"""
     import planet
     import atmosphere
     pyPlanetPath = os.getenv('PYPLANETPATH')
     if pyPlanetPath == None:
         print('No PYPLANETPATH environment variable')
         pyPlanetPath = './'
     atm = atmosphere.atmosphere('neptune', pyPlanetPath)
     atm.run()
     p = planet.planet('functions')
     bdata = p.bRequest(self.header['b'][0], block=[1, 1])
     if len(bdata) != np.size(self.data):
         print(
             'b-values (%d) do not number the same as the image size (%d)' %
             (len(bdata), np.size(self.data)))
         return 0
     radii = []
     for i in range(len(self.header['radii'])):
         if isinstance(self.header['radii'][i], self.scalar):
             radii.append(self.header['radii'][i])
     rNorm = self.header['rNorm'][0]
     Req = np.max(radii)
     Rpol = np.min(radii)
     f = (Req - Rpol) / Req
     gtype = 'ellipse'
     tip = self.header['aspect'][0]
     tip *= math.pi / 180.0
     rotate = self.header['aspect'][1]
     #rotate = -1.0*math.atan(math.tan(rotate*math.pi/180.0)*(1.0-f)**2)
     rotate *= math.pi / 180.0
     lat_pg = latmod * math.pi / 180.0
     lat_pcmod = math.atan(math.tan(lat_pg) * (1.0 - f)**2)
     pixel_modlist = []
     nedit = 0
     if isinstance(Tmod, self.scalar):
         Tmod = list(Tmod)
     if len(Tmod) != len(limb):
         print('limb is incorrectly specified')
         return 0
     for i in range(len(bdata)):
         edge, bmod = raypath.__findEdge__(atm,
                                           bdata[i],
                                           rNorm,
                                           tip,
                                           rotate,
                                           gtype,
                                           printdot=False)
         if edge == None:
             continue
         pclat = math.asin(
             np.dot(edge, raypath.yHat) / np.linalg.norm(edge))
         delta_lng = math.atan2(np.dot(edge, raypath.xHat),
                                np.dot(edge, raypath.zHat))
         if pclat > 0.0:
             break
         if pclat < lat_pcmod:
             row = int(float(i) // float(len(self.data)))
             col = i - row * len(self.data)
             pixel_modlist.append([row, col, i])
             nedit += 1
     breakb = 0.96
     if len(Tmod) > 1:
         wherebb = np.where(np.array(limb) < breakb)
         Tfunc3 = interpolate.interp1d(
             limb[wherebb[0][0]:wherebb[0][-1] + 1],
             Tmod[wherebb[0][0]:wherebb[0][-1] + 1],
             kind=3,
             bounds_error=False,
             fill_value=0.0)
         Tfunc1 = interpolate.interp1d(limb, Tmod, kind=1)
     else:
         Tfunc3 = lambda x: Tmod[0]
         Tfunc1 = lambda x: Tmod[0]
     testPlotLimb = False
     if testPlotLimb:
         pltl = np.linspace(limb[0], limb[-1], 50)
         pltt = Tfunc3(pltl)
         plt.figure('limbFunction')
         plt.plot(pltl, pltt)
         pltt = Tfunc1(pltl)
         plt.plot(pltl, pltt)
         plt.plot(limb, Tmod, 'o')
         math.sqrt(-1.)
     for px in pixel_modlist:
         bval = math.sqrt(bdata[px[2]][0]**2 + bdata[px[2]][1]**2)
         if bval < limb[0]:
             bval = limb[0]
         elif bval > limb[-1]:
             bval = limb[-1]
         if bval < breakb:
             Tnew = Tfunc3(bval)
         else:
             Tnew = Tfunc1(bval)
         self.data[px[0], px[1]] = Tnew
     return nedit
Esempio n. 17
0
	def __init__(self, mass, radius, atmcsv=None):
		self.mass = mass
		self.radius = radius
		if atmcsv:
			self.atm = atmosphere(atmcsv)