Esempio n. 1
0
def plotbrvr(fName,shell,tsolar,outer_grid=None,lims={'br':[-5.,5.],
                                      'vr':[200.,800]}):
    # get LFM stuff out
    simtime = lfmhlib.get_time(fName)
    R,theta,phi = lfmhlib.r_theta_phi_uniform(fName)
    R/=6.96e10   # FIX ME HARD CODED UNITS
#    islice=argmin(abs(R-shell))   # index of the desired radial distance
    islice = shell


    br = lfmhlib.read_var(fName,'br')
    vr = lfmhlib.read_var(fName,'vr')

    # shift to start of CR
    br = lfmhlib.time_shift(simtime,br[:,:,islice],tsolar)
    vr = lfmhlib.time_shift(simtime,vr[:,:,islice],tsolar)

    # Plot
    if outer_grid==None:
        gs = gridspec.GridSpec(2,2,width_ratios=[14,1],hspace=0.1)
    else:
        gs = gridspec.GridSpecFromSubplotSpec(2,2,subplot_spec=outer_grid,width_ratios=[14,1],hspace=0.1)

    p1c = 0.5*(phi[1:]+phi[:-1])
    t1c = 0.5*(theta[1:]+theta[:-1])

    # Br
    ax1=plt.subplot(gs[0,0],aspect='equal')
    ax1_cb=plt.subplot(gs[0,1])
    p1=ax1.pcolormesh(phi*180/pi,(pi/2.-theta)*180./pi,br.T*1.e5,vmin=lims['br'][0],vmax=lims['br'][1],cmap='RdBu_r',rasterized=True)
    plt.colorbar(p1,cax=ax1_cb).set_label(r'B$_r$, nT')
    ax1.contour(p1c*180./pi,(pi/2-t1c)*180/pi,br.T,[0.],colors='black')
    ax1.axhline(0.,linestyle='--',color='black')

    # Vr
    ax2=plt.subplot(gs[1,0],aspect='equal',sharex=ax1)
    ax2_cb=plt.subplot(gs[1,1])
    p2=ax2.pcolormesh(phi*180/pi,(pi/2.-theta)*180./pi,vr.T*1.e-5,vmin=lims['vr'][0],vmax=lims['vr'][1],rasterized=True)
    plt.colorbar(p2,cax=ax2_cb).set_label(r'V$_r$, km/s')
    plt.axhline(0)
    ax2.contour(p1c*180./pi,(pi/2-t1c)*180/pi,br.T,[0.],colors='white')
    ax2.axhline(0.,linestyle='--',color='white')

    for ax in [ax1,ax2]:
        ax.set_ylabel(r'$\theta$')
        ax.set_xlim(0,360)
        ax.set_ylim(-70,70)

        if ax!=ax2:
            plt.setp(ax.get_xticklabels(), visible=False) 
        else:
            ax.set_xlabel(r'$\phi$')

    return(ax1,ax2)
Esempio n. 2
0
    pace = (pi-Omega*(simtime-simtime0))%(2*pi)
    tace = 90.-ACE_theta[aceind]

    # look for the corresponding MSGR record
    msgrind = argmin([abs((ddd-d).total_seconds()) for ddd in MSGR_dati])
    pace1 = (pi-Omega*(simtime-simtime0))
    pmsgr = (pace1 - (ACE_phi[aceind]-MSGR_phi[msgrind])*pi/180.)%(2*pi)
    tmsgr = 90.-MSGR_theta[msgrind]


    iace=argmin(abs(R-ACE_r[aceind]*215.))   # index of the desired radial distance
    jace=argmin(abs(pi/2.-theta-tace*pi/180.))   # index of the desired theta-angle
    kace = floor(pace/(2*pi)*nk)

    v = lfmhlib.read_var(f,'vr')
    b = lfmhlib.read_var(f,'br')
    vr.append(v[kace,jace,iace])
    br.append(b[kace,jace,iace])

    v= lfmhlib.read_var(lfmFiles[start_ind],'vr')
    b= lfmhlib.read_var(lfmFiles[start_ind],'br')
    vr0.append(v[kace,jace,iace])
    br0.append(b[kace,jace,iace])

    fig.suptitle(d.strftime('%Y:%m:%d %H:%M'),y=0.95)
    
#    (ax1,ax2,ax3,ax4) = summary.plots(f,iace,1.e25)
    (ax1,ax2) = summary.plotbrvr(f,iace,1.e25,outer_grid=gs[0])
    ax1.scatter(pace*180/pi,tace)
    ax2.scatter(pace*180/pi,tace)
Esempio n. 3
0
#parser.add_argument('limits',help='',type=float)
parser.add_argument('Tsolar',
                    help='T solar rotation in code units.',
                    type=float,
                    default=25.38 * 24 * 3600,
                    nargs='?')
args = parser.parse_args()
#----------- PARSE ARGUMENTS ---------#

# get LFM stuff out
simtime = lfmhlib.get_time(args.hdfFileName)
R, theta, phi = lfmhlib.r_theta_phi_uniform(args.hdfFileName)
R /= 6.96e10  # FIX ME HARD CODED UNITS
islice = argmin(abs(R - args.shell))  # index of the desired radial distance

br = lfmhlib.read_var(args.hdfFileName, 'br')
vr = lfmhlib.read_var(args.hdfFileName, 'vr')
rho = lfmhlib.read_var(args.hdfFileName, 'rho')
c = lfmhlib.read_var(args.hdfFileName, 'c')

# shift to start of CR
br = lfmhlib.time_shift(simtime, br[:, :, islice], args.Tsolar)
vr = lfmhlib.time_shift(simtime, vr[:, :, islice], args.Tsolar)
rho = lfmhlib.time_shift(simtime, rho[:, :, islice], args.Tsolar)
c = lfmhlib.time_shift(simtime, c[:, :, islice], args.Tsolar)

# Plot
matplotlib.rc('mathtext', fontset='stixsans', default='regular')
fig = plt.figure(figsize=(12, 12))
fig.suptitle('Radial distance= %.2f' % args.shell)
Esempio n. 4
0
parser.add_argument('shell',
                    help='Radial shell in code units of distance.',
                    type=float)
parser.add_argument('variable', help='What to plot')
args = parser.parse_args()
#----------- PARSE ARGUMENTS ---------#

# CR start time from umtof.umd.edu/pm/crn
import datetime
start_time = datetime.datetime.strptime(args.crStartTime, '%Y %m %d %H %M')

# get LFM stuff out
simtime = lfmhlib.get_time(args.hdfFileName)
R, theta, phi = lfmhlib.r_theta_phi_uniform(args.hdfFileName)
islice = argmin(abs(R - args.shell))  # index of the desired radial distance
var = lfmhlib.read_var(args.hdfFileName, args.variable)
var = 0.5 * (var[:, (theta.shape[0] - 1) / 2 - 1, islice] +
             var[:, (theta.shape[0] - 1) / 2, islice]
             )  # extract equatorial value  # extract equatorial value
lfmhlib.time_shift(simtime, var, 25.38 * 24 * 3600)

# Plot
# ========== time dependence ==========
ut = lfmhlib.get_UT(simtime, phi)
ut = [start_time + datetime.timedelta(seconds=float(ttt)) for ttt in ut]

plt.plot(ut, var[::-1])
"""
matplotlib.rc('mathtext',fontset='stixsans',default='regular')
fig=plt.figure(figsize=(19.5,5.5))
ax1=plt.subplot(1,1,1,aspect='equal')
Esempio n. 5
0
    pace = (pi-Omega*(simtime-simtime0))%(2*pi)
    tace = 90.-ACE_theta[aceind]

    # look for the corresponding MSGR record
    msgrind = argmin([abs((ddd-d).total_seconds()) for ddd in MSGR_dati])
    pace1 = (pi-Omega*(simtime-simtime0))
    pmsgr = (pace1 - (ACE_phi[aceind]-MSGR_phi[msgrind])*pi/180.)%(2*pi)
    tmsgr = 90.-MSGR_theta[msgrind]


    iace=argmin(abs(R-ACE_r[aceind]*215.))   # index of the desired radial distance
    jace=argmin(abs(pi/2.-theta-tace*pi/180.))   # index of the desired theta-angle
    kace = floor(pace/(2*pi)*nk)

    v = lfmhlib.read_var(f,'vr')
    b = lfmhlib.read_var(f,'br')
    vr.append(v[kace,jace,iace])
    br.append(b[kace,jace,iace])

    v= lfmhlib.read_var(lfmFiles[start_ind],'vr')
    b= lfmhlib.read_var(lfmFiles[start_ind],'br')
    vr0.append(v[kace,jace,iace])
    br0.append(b[kace,jace,iace])

    fig.suptitle(d.strftime('%Y:%m:%d %H:%M'),y=0.95)
    
#    (ax1,ax2,ax3,ax4) = summary.plots(f,iace,1.e25)
    (ax1,ax2) = summary.plotbrvr(f,iace,1.e25,outer_grid=gs[0])
    ax1.scatter(pace*180/pi,tace)
    ax2.scatter(pace*180/pi,tace)
Esempio n. 6
0
    # look for the corresponding MSGR record
    msgrind = argmin([abs((ddd-d).total_seconds()) for ddd in MSGR_dati])

    # Need ACE longitude to figure out that of MSGR
    pace = (pi-Omega*(simtime-simtime0)) #%(2*pi)

    pmsgr = (pace - (ACE_phi[aceind]-MSGR_phi[msgrind])*pi/180.)%(2*pi)
    tmsgr = 90.-MSGR_theta[msgrind]


    imsgr=argmin(abs(R-MSGR_r[msgrind]*215.))   # index of the desired radial distance
    jmsgr=argmin(abs(pi/2.-theta-tmsgr*pi/180.))   # index of the desired theta-angle
    kmsgr = floor(pmsgr/(2*pi)*nk)

    b = lfmhlib.read_var(f,'br')
    br.append(b[kmsgr,jmsgr,imsgr])

    fig.suptitle(dates[i].strftime('%Y:%m:%d %H:%M'),y=0.95)
    
    rc=0.5*(R[:-1]+R[1:])
    phic=0.5*(phi[:-1]+phi[1:])
    phic=append(phic,phic[0])
    rr,pp = meshgrid(rc*sin((90.-tmsgr)*pi/180.),phic)
    ax1=subplot(gs[0,0],aspect='equal')
    bplot = vstack([b[:,jmsgr,:],b[0,jmsgr,:]])*(rc/rc[0])**2*1.e5
    p=ax1.pcolormesh(rr*cos(pp),rr*sin(pp),bplot,shading='gouraud',vmin=-160,vmax=160,cmap=cm.RdBu_r)
    ax1.set_xlim(-230,230)
    ax1.set_ylim(-230,230)
    ax1.set_xlabel('X, Rs')
    ax1.set_ylabel('Y, Rs')
Esempio n. 7
0
parser.add_argument('shell',help='Radial shell in code units of distance.',type=float)
parser.add_argument('variable',help='What to plot')
args = parser.parse_args()
#----------- PARSE ARGUMENTS ---------#


# CR start time from umtof.umd.edu/pm/crn
import datetime
start_time=datetime.datetime.strptime(args.crStartTime,'%Y %m %d %H %M')


# get LFM stuff out
simtime = lfmhlib.get_time(args.hdfFileName)
R,theta,phi = lfmhlib.r_theta_phi_uniform(args.hdfFileName)
islice=argmin(abs(R-args.shell))   # index of the desired radial distance
var = lfmhlib.read_var(args.hdfFileName,args.variable)
var = 0.5*(var[:,(theta.shape[0]-1)/2-1,islice] +
           var[:,(theta.shape[0]-1)/2,islice])   # extract equatorial value  # extract equatorial value
lfmhlib.time_shift(simtime,var,25.38*24*3600)


# Plot
# ========== time dependence ==========
ut = lfmhlib.get_UT(simtime,phi)
ut=[start_time+datetime.timedelta(seconds=float(ttt)) for ttt in ut]

plt.plot(ut,var[::-1])
"""
matplotlib.rc('mathtext',fontset='stixsans',default='regular')
fig=plt.figure(figsize=(19.5,5.5))
ax1=plt.subplot(1,1,1,aspect='equal')
Esempio n. 8
0
def plots(fName,shell,tsolar,gamma):
    # get LFM stuff out
    simtime = lfmhlib.get_time(fName)
    R,theta,phi = lfmhlib.r_theta_phi_uniform(fName)
    R/=6.96e10   # FIX ME HARD CODED UNITS
    islice=argmin(abs(R-shell))   # index of the desired radial distance


    br = lfmhlib.read_var(fName,'br')
    vr = lfmhlib.read_var(fName,'vr')
    rho = lfmhlib.read_var(fName,'rho')
    c = lfmhlib.read_var(fName,'c')

    # shift to start of CR
    br = lfmhlib.time_shift(simtime,br[:,:,islice],tsolar)
    vr = lfmhlib.time_shift(simtime,vr[:,:,islice],tsolar)
    rho = lfmhlib.time_shift(simtime,rho[:,:,islice],tsolar)
    c = lfmhlib.time_shift(simtime,c[:,:,islice],tsolar)


    # Plot
    gs = gridspec.GridSpec(4,2,width_ratios=[14,1])

    p1c = 0.5*(phi[1:]+phi[:-1])
    t1c = 0.5*(theta[1:]+theta[:-1])

    # Br
    ax1=plt.subplot(gs[0,0],aspect='equal')
    ax1_cb=plt.subplot(gs[0,1])
    p1=ax1.pcolormesh(phi*180/pi,(pi/2.-theta)*180./pi,br.T*1.e5,vmin=-120.,vmax=120.,cmap='RdBu_r',rasterized=True)
    plt.colorbar(p1,cax=ax1_cb).set_label(r'B$_r$, nT')
    ax1.contour(p1c*180./pi,(pi/2-t1c)*180/pi,br.T,[0.],colors='black')

    # Vr
    ax2=plt.subplot(gs[1,0],aspect='equal',sharex=ax1)
    ax2_cb=plt.subplot(gs[1,1])
    p2=ax2.pcolormesh(phi*180/pi,(pi/2.-theta)*180./pi,vr.T*1.e-5,vmin=200.,vmax=800.,rasterized=True)
    plt.colorbar(p2,cax=ax2_cb).set_label(r'V$_r$, km/s')
    plt.axhline(0)
    ax2.contour(p1c*180./pi,(pi/2-t1c)*180/pi,br.T,[0.],colors='white')

    # rho
    ax3=plt.subplot(gs[2,0],aspect='equal',sharex=ax1)
    ax3_cb=plt.subplot(gs[2,1])
#    p3=ax3.pcolormesh(phi*180/pi,(pi/2-theta)*180./pi,log10(rho.T/1.67e-24),vmin=0.4,vmax=1.5,rasterized=True)
    p3=ax3.pcolormesh(phi*180/pi,(pi/2-theta)*180./pi,rho.T/1.67e-24,vmin=200,vmax=1600,rasterized=True)
#    plt.colorbar(p3,cax=ax3_cb).set_label(r'log$_{10}(n\,\mathrm{cm}^{-3}$)')
    plt.colorbar(p3,cax=ax3_cb).set_label(r'n, cm$^{-3}$')
    ax3.contour(p1c*180./pi,(pi/2-t1c)*180/pi,br.T,[0.],colors='white')

    # temperature
    T=1./gamma*c**2*1.67e-24/1.38e-16 # T in K  # FIX ME HARD CODE UNITS AND GAMMA
    ax4=plt.subplot(gs[3,0],aspect='equal',sharex=ax1)
    ax4_cb=plt.subplot(gs[3,1])
#    p4=ax4.pcolormesh(phi*180/pi,(pi/2-theta)*180./pi,log10(T.T),vmin=4.5,vmax=5.4,rasterized=True)
    p4=ax4.pcolormesh(phi*180/pi,(pi/2-theta)*180./pi,T.T*1.e-6,vmin=0.1,vmax=2,rasterized=True)
#    plt.colorbar(p4,cax=ax4_cb).set_label(r'log$_{10}$(T, K)')
    plt.colorbar(p4,cax=ax4_cb).set_label(r'T, MK')
    ax4.contour(p1c*180./pi,(pi/2-t1c)*180/pi,br.T,[0.],colors='white')


    for ax in [ax1,ax2,ax3,ax4]:
        ax.set_ylabel(r'$\theta$')
        ax.set_xlim(0,360)
        ax.set_ylim(-90,90)

        if ax!=ax4:
            plt.setp(ax.get_xticklabels(), visible=False) 
        else:
            ax.set_xlabel(r'$\phi$')

    return(ax1,ax2,ax3,ax4)
Esempio n. 9
0
parser.add_argument('hdfFileName',help='LFM-helio file to use')
parser.add_argument('shell',help='Radial shell in code units of distance.',type=float)
 #parser.add_argument('limits',help='',type=float)
parser.add_argument('Tsolar',help='T solar rotation in code units.',type=float,default=25.38*24*3600,nargs='?')
args = parser.parse_args()
#----------- PARSE ARGUMENTS ---------#


# get LFM stuff out
simtime = lfmhlib.get_time(args.hdfFileName)
R,theta,phi = lfmhlib.r_theta_phi_uniform(args.hdfFileName)
R/=6.96e10   # FIX ME HARD CODED UNITS
islice=argmin(abs(R-args.shell))   # index of the desired radial distance


br = lfmhlib.read_var(args.hdfFileName,'br')
vr = lfmhlib.read_var(args.hdfFileName,'vr')
rho = lfmhlib.read_var(args.hdfFileName,'rho')
c = lfmhlib.read_var(args.hdfFileName,'c')

# shift to start of CR
br = lfmhlib.time_shift(simtime,br[:,:,islice],args.Tsolar)
vr = lfmhlib.time_shift(simtime,vr[:,:,islice],args.Tsolar)
rho = lfmhlib.time_shift(simtime,rho[:,:,islice],args.Tsolar)
c = lfmhlib.time_shift(simtime,c[:,:,islice],args.Tsolar)


# Plot
matplotlib.rc('mathtext',fontset='stixsans',default='regular')
fig=plt.figure(figsize=(12,12))
fig.suptitle('Radial distance= %.2f' % args.shell)