version 1.3, 2019/03/04 17:33:22
|
version 1.4, 2019/04/08 16:52:19
|
Line 105 def writesurfacemodel(lmin=0, lmax=300, |
|
Line 105 def writesurfacemodel(lmin=0, lmax=300, |
|
| |
| |
def image2sphere(xpixels=1000, ypixels=1000, distobs=220.0, \ | def image2sphere(xpixels=1000, ypixels=1000, distobs=220.0, \ |
bangle=-30.0, pangle=0.0): |
bangle=30.0, pangle=0.0, xoffset=0.0, yoffset=0.0): |
| |
p = pangle*np.pi/180 | p = pangle*np.pi/180 |
b0 = bangle*np.pi/180 | b0 = bangle*np.pi/180 |
#distobs = 220.0 # solar radii | #distobs = 220.0 # solar radii |
#xpixels = 1000 | #xpixels = 1000 |
#ypixels = 1000 | #ypixels = 1000 |
x0 = xpixels/2-0.5 |
x0 = xpixels/2-0.5 + xoffset |
y0 = ypixels/2-0.5 |
y0 = ypixels/2-0.5 + yoffset |
imscale = 1.97784*1024/xpixels | imscale = 1.97784*1024/xpixels |
scale = imscale/(180*60*60/np.pi) | scale = imscale/(180*60*60/np.pi) |
rsun=np.tan(np.arcsin(1/distobs))/scale | rsun=np.tan(np.arcsin(1/distobs))/scale |
Line 188 def image2sphere(xpixels=1000, ypixels=1 |
|
Line 188 def image2sphere(xpixels=1000, ypixels=1 |
|
return (ph, th) | return (ph, th) |
| |
| |
def image2rtheta(xpixels=1000, ypixels=1000, distobs=220.0): |
def image2rtheta(xpixels=1000, ypixels=1000, distobs=220.0, xoffset=0.0, yoffset=0.0, \ |
|
bangle=0.0, pangle=0.0, gamma=0.0): |
| |
|
p = pangle*np.pi/180 |
|
b0 = bangle*np.pi/180 |
|
g = gamma*np.pi/180 |
imscale = 1.97784*1024/xpixels | imscale = 1.97784*1024/xpixels |
scale = imscale/(180*60*60/np.pi) | scale = imscale/(180*60*60/np.pi) |
rsun=np.tan(np.arcsin(1/distobs))/scale | rsun=np.tan(np.arcsin(1/distobs))/scale |
x0 = xpixels/2-0.5 |
x0 = xpixels/2-0.5 + xoffset |
y0 = ypixels/2-0.5 |
y0 = ypixels/2-0.5 + yoffset |
xx = (np.linspace(0, xpixels-1, xpixels)-x0)/rsun | xx = (np.linspace(0, xpixels-1, xpixels)-x0)/rsun |
yy = (np.linspace(0, ypixels-1, ypixels)-y0)/rsun |
zz = (np.linspace(0, ypixels-1, ypixels)-y0)/rsun |
xx, yy = np.meshgrid(xx, yy) |
xx, zz = np.meshgrid(xx, zz) |
rr = np.sqrt(xx*xx+yy*yy) |
|
|
xx /= np.cos(g) |
|
zz /= np.cos(b0) |
|
x1 = xx*np.cos(p) + zz*np.sin(p) |
|
z1 = -xx*np.sin(p) + zz*np.cos(p) |
|
|
|
rr = np.sqrt(x1*x1 + z1*z1) |
index = (rr <= 1.0) | index = (rr <= 1.0) |
r = np.ma.array(rr, mask=np.logical_not(index)) | r = np.ma.array(rr, mask=np.logical_not(index)) |
# lat = np.arctan(yy/np.abs(xx)) |
angle = np.arctan2(x1,z1) |
lat = np.arctan2(yy,np.abs(xx)) |
theta = np.ma.array(np.abs(angle), mask=r.mask) |
theta = np.ma.array(np.pi/2 - lat, mask=np.logical_not(index)) |
phi = 0.0*theta |
|
index = (angle < 0.0) |
|
phi[index]=np.pi |
| |
return (r, theta) |
return (r, theta, phi) |
| |
| |
def setplm(l, m, x, plm, dplm): | def setplm(l, m, x, plm, dplm): |