Display from one plane to another plane despite masking areas
I have a dataset shown here where the first and second columns are the coordinates of the sky (ra, dec), respectively, and the third and fourth are the coordinates in the Cartesian system (x, y).
I need to render a 2D interpolation surface using the coordinates x
and y
and the other using the Ra
and Dec
. The problem is the existence of masked areas as shown in the picture above. I can illustrate the missing data by simply plotting it (there is a value in the directory NaN
). This is what I have tried so far and did not give the correct answer:
from scipy.interpolate import griddata import numpy as np import matplotlib.pyplot as plt data = np.loadtxt('test.asc') ra = data[:,0] dec = data[:,1] Xpos = data[:,2] Ypos = data[:,3] xi = np.linspace(Xpos.min(), Xpos.max(), 1000) yi = np.linspace(Ypos.min(), Ypos.max(), 1000) xi, yi = np.meshgrid(xi, yi, copy=False) ra_int = griddata(data[:,2:4], ra, (xi.flatten(), yi.flatten()), method='cubic') dec_int = griddata(data[:,2:4], dec, (xi.flatten(), yi.flatten()), method='cubic')
Usage griddata
fails and only returns values NaN
. Is there a way to do this interpolation to estimate values to Ra
and Dec
from given coordinates x
and y
even masked areas (map from x
and y
to Ra
and Dec
)?
source to share
If I understood correctly, it looks like this:
just shift the Cartesian coordinate system to the middle of the CCD , and also the equatorial coordinates to the middle of the CCD . Then calculate x,y
separately. The only thing you need is to calculate the focus length f
separately for x
and y
!!!
pos
is a Cartesian coordinate (x or y)
ang
is an equatorial coordinate (RA or Dec)
-
get edge point from database
slide the corners to the middle of the CCD
-
calculate focus
(fx,fy)
from itf = pos/tan(ang)
-
now you can compute the projection for any record in the dataset
shift the corners to the middle of the CCD , then calculate
x,y
bypos=f*tan(ang)
slide back from the CCD from the middle to the original Cartesian coordinates. You have to check several points if this approach is correct
[notes]
x
the axis is reflected in your output, so just use x=-x
at the end before moving to the original cartesian coordinates or leaving the focus f
negative.
if your CCD is not axially oriented to the equator, you need to calculate the rotation (the angle between the axis x
and the equator) and apply the rotation around the axis Z
after transformation before shifting back ...
source to share