Loading .gitignore +2 −0 Original line number Diff line number Diff line *.pyc *__pycache__* *docs/_build/* *docs/jupyter_execute/* src/lspe_prm/__init__.py +2 −1 Original line number Diff line number Diff line Loading @@ -9,4 +9,5 @@ except : from .roto_translation import * from .lspe_prm import * from .lspe_prm import PRM0 src/lspe_prm/lspe_prm.py +92 −16 Original line number Diff line number Diff line Loading @@ -98,98 +98,134 @@ Issue import numpy as np class PRM0 : """ PRM of order 0 1. Telescope is assumed to be rigid; 1. """ @property def roll(self) : """Camera roll angle [deg]""" return self._d['roll'] @roll.setter def roll(self,this) : self._d['roll']=this self._mark['roll']=1 self._matr['roll']=self.ERotZ(np.deg2rad(np.array([this]))) self._isComplete=False # @property def pan(self) : """Camera pan angle [deg]""" return self._d['pan'] @pan.setter def pan(self,this) : self._d['pan']=this self._mark['pan']=1 self._matr['pan']=self.ERotY(np.deg2rad(np.array([this]))) self._isComplete=False # @property def tilt(self) : """Camera tilt angle [deg]""" return self._d['tilt'] @tilt.setter def tilt(self,this) : self._d['tilt']=this self._mark['tilt']=1 self._matr['tilt']=self.ERotX(np.deg2rad(np.array([this]))) self._isComplete=False # @property def thetaSign(self) : """The sign for theta (either +1 or -1)""" return self._thetaSign @thetaSign.setter def thetaSign(self,this) : self._thetaSign=int(this) self._mark['thetaSign']=1 self._isComplete=False # @property def ctheta0(self) : """Azimuth rotation origin angle [deg]""" return self._d['ctheta0'] @ctheta0.setter def ctheta0(self,this) : self._d['ctheta0']=this self._mark['ctheta0']=1 self._matr['ctheta0']=self.ERotY(-np.deg2rad(np.array([this]))) self._isComplete=False # @property def phiSign(self) : """The sign for phi (either +1 or -1)""" return self._phiSign @phiSign.setter def phiSign(self,this) : self._phiSign=int(this) self._mark['phiSign']=1 self._isComplete=False # @property def cphi0(self) : """Alt rotation origin angle [deg]""" return self._d['cphi0'] @cphi0.setter def cphi0(self,this) : self._d['cphi0']=this self._mark['cphi0']=1 self._matr['cphi0']=self.ERotZ(-np.deg2rad(np.array([this]))) self._isComplete=False # @property def tiltFork(self) : """tiltFork angle [deg]""" return self._d['tiltFork'] @tiltFork.setter def tiltFork(self,this) : self._d['tiltFork']=this self._mark['tiltFork']=1 self._matr['tiltFork']=self.ERotX(np.deg2rad(np.array([this]))) self._isComplete=False # @property def zVAX(self) : """zVAX angle [deg]""" return self._d['zVAX'] @zVAX.setter def zVAX(self,this) : self._d['zVAX']=this self._mark['zVAX']=1 self._matr['zVAX']=self.ERotX(np.deg2rad(np.array([this]))) self._isComplete=False # @property def omegaVAX(self) : """omegaVAX angle [deg]""" return self._d['omegaVAX'] @omegaVAX.setter def omegaVAX(self,this) : self._d['omegaVAX']=this self._mark['omegaVAX']=1 self._matr['omegaVAX']=self.ERotZ(np.deg2rad(np.array([this]))) self._isComplete=False # @property def isComplete(self) : """ True if isAllSet and matrices are calculated """ return self._isComplete # @property def isAllSet(self) : """ True if all the parameters are set """ for k in self.keys() : if self._mark[k]==0 : return False return True # def __init__(self,ideal=False) : """ Keywords -------- idea = True if an Ideal setup has to be created (all the Configuration angles set to zero) """ self._isComplete=False self._d={} for k in self.keys() : Loading @@ -204,21 +240,24 @@ class PRM0 : self.setIdeal() # def keys(self) : return ['roll','pan','tilt','ctheta0','cphi0','tiltFork','zVAX','omegaVAX'] """return angles names""" return ['roll','pan','tilt','thetaSign','ctheta0','phiSign','cphi0','tiltFork','zVAX','omegaVAX'] # def __getitem__(self,this) : return self._d[this] # def copy(self) : """make a physical copy""" import copy return copy.deepcopy(self) # def __setitem__(self,this,that) : self._d[this]=that # def M(self,k) : """return a given rotation matrix""" return self._matr[k] # def copy(self) : import copy return copy.deepcopy(self) # def _base_matrix(self,Angle) : _angle=np.array([Angle]) if np.isscalar(Angle) else Angle c=np.cos(_angle) Loading @@ -230,6 +269,12 @@ class PRM0 : return I,c,s # def ERotX(self,Angle) : """matrix of rotation about X axis Parameters ---------- Angle = angle in deg """ R,c,s=self._base_matrix(Angle) R[:,1,1]= c R[:,1,2]=-s Loading @@ -238,6 +283,12 @@ class PRM0 : return R # def ERotY(self,Angle) : """matrix of rotation about Y axis Parameters ---------- Angle = angle in deg """ R,c,s=self._base_matrix(Angle) R[:,0,0]= c R[:,0,2]= s Loading @@ -246,6 +297,12 @@ class PRM0 : return R # def ERotZ(self,Angle) : """matrix of rotation about Z axis Parameters ---------- Angle = angle in deg """ R,c,s=self._base_matrix(Angle) R[:,0,0]= c R[:,0,1]=-s Loading @@ -254,18 +311,26 @@ class PRM0 : return R # def setIdeal(self) : """set the angles as for an ideal telescope""" self.roll=0. self.pan=0. self.tilt=0. self.tiltFork=0. self.zVAX=0. self.omegaVAX=0. self.phiSign=1 self.cphi0=0. self.tethaPhi=1 self.ctheta0=0. self.commit() # def commit(self,oldWobble=False) : """ if oldWobble==True the old version of wobble angle operator is applied """ If all the parameters are set (isAllSet==True), computes alle the constant rotation matrices. Kwywords -------- oldWobble, if True the old version of wobble angle operator is applied default False current version : M3 = matr['omegaVAX'].dot(matr['zVAX'].dot(matr['omegaVAX'].T)) old version : M3 = matr['omegaVAX'].dot(matr['zVAX']) Loading @@ -273,6 +338,17 @@ class PRM0 : the old version does not handle properly the cases zVAX=0. """ if self.isAllSet : # #single angle rotation matrices self._matr['roll']=self.ERotZ(np.deg2rad(np.array([this]))) self._matr['pan']=self.ERotY(np.deg2rad(np.array([this]))) self._matr['tilt']=self.ERotX(np.deg2rad(np.array([this]))) self._matr['ctheta0']=self.ERotY(-self._thetaSign*np.deg2rad(np.array([this]))) self._matr['cphi0']=self.ERotZ(-self._phiSign*np.deg2rad(np.array([this]))) self._matr['tiltFork']=self.ERotX(np.deg2rad(np.array([this]))) self._matr['zVAX']=self.ERotX(np.deg2rad(np.array([this]))) self._matr['omegaVAX']=self.ERotZ(np.deg2rad(np.array([this]))) # out=self._matr['tilt'][0].dot(self._matr['pan'][0].dot(self._matr['roll'][0])) out=self._matr['ctheta0'][0].dot(out) out.shape=(1,3,3) Loading Loading @@ -348,10 +424,10 @@ while PMatrB[0] is the rotation matrix for the case (45.,0.) and PMatrB[:,2] is self._d['CTHETA_PHI']=CTHETA_PHI # # theta rotation self._matr['CTRL_THETA']=self.ERotY(np.deg2rad(CTHETA_PHI[:,0])) self._matr['CTRL_THETA']=self.ERotY(self._thetaSign*np.deg2rad(CTHETA_PHI[:,0])) # # phi rotation self._matr['CTRL_PHI']=self.ERotZ(np.deg2rad(CTHETA_PHI[:,1])) self._matr['CTRL_PHI']=self.ERotZ(self._phiSign*np.deg2rad(CTHETA_PHI[:,1])) # # apply each theta rotation to M1 out=[k.dot(self._matr['M1'][0]) for k in self._matr['CTRL_THETA']] Loading Loading
.gitignore +2 −0 Original line number Diff line number Diff line *.pyc *__pycache__* *docs/_build/* *docs/jupyter_execute/*
src/lspe_prm/__init__.py +2 −1 Original line number Diff line number Diff line Loading @@ -9,4 +9,5 @@ except : from .roto_translation import * from .lspe_prm import * from .lspe_prm import PRM0
src/lspe_prm/lspe_prm.py +92 −16 Original line number Diff line number Diff line Loading @@ -98,98 +98,134 @@ Issue import numpy as np class PRM0 : """ PRM of order 0 1. Telescope is assumed to be rigid; 1. """ @property def roll(self) : """Camera roll angle [deg]""" return self._d['roll'] @roll.setter def roll(self,this) : self._d['roll']=this self._mark['roll']=1 self._matr['roll']=self.ERotZ(np.deg2rad(np.array([this]))) self._isComplete=False # @property def pan(self) : """Camera pan angle [deg]""" return self._d['pan'] @pan.setter def pan(self,this) : self._d['pan']=this self._mark['pan']=1 self._matr['pan']=self.ERotY(np.deg2rad(np.array([this]))) self._isComplete=False # @property def tilt(self) : """Camera tilt angle [deg]""" return self._d['tilt'] @tilt.setter def tilt(self,this) : self._d['tilt']=this self._mark['tilt']=1 self._matr['tilt']=self.ERotX(np.deg2rad(np.array([this]))) self._isComplete=False # @property def thetaSign(self) : """The sign for theta (either +1 or -1)""" return self._thetaSign @thetaSign.setter def thetaSign(self,this) : self._thetaSign=int(this) self._mark['thetaSign']=1 self._isComplete=False # @property def ctheta0(self) : """Azimuth rotation origin angle [deg]""" return self._d['ctheta0'] @ctheta0.setter def ctheta0(self,this) : self._d['ctheta0']=this self._mark['ctheta0']=1 self._matr['ctheta0']=self.ERotY(-np.deg2rad(np.array([this]))) self._isComplete=False # @property def phiSign(self) : """The sign for phi (either +1 or -1)""" return self._phiSign @phiSign.setter def phiSign(self,this) : self._phiSign=int(this) self._mark['phiSign']=1 self._isComplete=False # @property def cphi0(self) : """Alt rotation origin angle [deg]""" return self._d['cphi0'] @cphi0.setter def cphi0(self,this) : self._d['cphi0']=this self._mark['cphi0']=1 self._matr['cphi0']=self.ERotZ(-np.deg2rad(np.array([this]))) self._isComplete=False # @property def tiltFork(self) : """tiltFork angle [deg]""" return self._d['tiltFork'] @tiltFork.setter def tiltFork(self,this) : self._d['tiltFork']=this self._mark['tiltFork']=1 self._matr['tiltFork']=self.ERotX(np.deg2rad(np.array([this]))) self._isComplete=False # @property def zVAX(self) : """zVAX angle [deg]""" return self._d['zVAX'] @zVAX.setter def zVAX(self,this) : self._d['zVAX']=this self._mark['zVAX']=1 self._matr['zVAX']=self.ERotX(np.deg2rad(np.array([this]))) self._isComplete=False # @property def omegaVAX(self) : """omegaVAX angle [deg]""" return self._d['omegaVAX'] @omegaVAX.setter def omegaVAX(self,this) : self._d['omegaVAX']=this self._mark['omegaVAX']=1 self._matr['omegaVAX']=self.ERotZ(np.deg2rad(np.array([this]))) self._isComplete=False # @property def isComplete(self) : """ True if isAllSet and matrices are calculated """ return self._isComplete # @property def isAllSet(self) : """ True if all the parameters are set """ for k in self.keys() : if self._mark[k]==0 : return False return True # def __init__(self,ideal=False) : """ Keywords -------- idea = True if an Ideal setup has to be created (all the Configuration angles set to zero) """ self._isComplete=False self._d={} for k in self.keys() : Loading @@ -204,21 +240,24 @@ class PRM0 : self.setIdeal() # def keys(self) : return ['roll','pan','tilt','ctheta0','cphi0','tiltFork','zVAX','omegaVAX'] """return angles names""" return ['roll','pan','tilt','thetaSign','ctheta0','phiSign','cphi0','tiltFork','zVAX','omegaVAX'] # def __getitem__(self,this) : return self._d[this] # def copy(self) : """make a physical copy""" import copy return copy.deepcopy(self) # def __setitem__(self,this,that) : self._d[this]=that # def M(self,k) : """return a given rotation matrix""" return self._matr[k] # def copy(self) : import copy return copy.deepcopy(self) # def _base_matrix(self,Angle) : _angle=np.array([Angle]) if np.isscalar(Angle) else Angle c=np.cos(_angle) Loading @@ -230,6 +269,12 @@ class PRM0 : return I,c,s # def ERotX(self,Angle) : """matrix of rotation about X axis Parameters ---------- Angle = angle in deg """ R,c,s=self._base_matrix(Angle) R[:,1,1]= c R[:,1,2]=-s Loading @@ -238,6 +283,12 @@ class PRM0 : return R # def ERotY(self,Angle) : """matrix of rotation about Y axis Parameters ---------- Angle = angle in deg """ R,c,s=self._base_matrix(Angle) R[:,0,0]= c R[:,0,2]= s Loading @@ -246,6 +297,12 @@ class PRM0 : return R # def ERotZ(self,Angle) : """matrix of rotation about Z axis Parameters ---------- Angle = angle in deg """ R,c,s=self._base_matrix(Angle) R[:,0,0]= c R[:,0,1]=-s Loading @@ -254,18 +311,26 @@ class PRM0 : return R # def setIdeal(self) : """set the angles as for an ideal telescope""" self.roll=0. self.pan=0. self.tilt=0. self.tiltFork=0. self.zVAX=0. self.omegaVAX=0. self.phiSign=1 self.cphi0=0. self.tethaPhi=1 self.ctheta0=0. self.commit() # def commit(self,oldWobble=False) : """ if oldWobble==True the old version of wobble angle operator is applied """ If all the parameters are set (isAllSet==True), computes alle the constant rotation matrices. Kwywords -------- oldWobble, if True the old version of wobble angle operator is applied default False current version : M3 = matr['omegaVAX'].dot(matr['zVAX'].dot(matr['omegaVAX'].T)) old version : M3 = matr['omegaVAX'].dot(matr['zVAX']) Loading @@ -273,6 +338,17 @@ class PRM0 : the old version does not handle properly the cases zVAX=0. """ if self.isAllSet : # #single angle rotation matrices self._matr['roll']=self.ERotZ(np.deg2rad(np.array([this]))) self._matr['pan']=self.ERotY(np.deg2rad(np.array([this]))) self._matr['tilt']=self.ERotX(np.deg2rad(np.array([this]))) self._matr['ctheta0']=self.ERotY(-self._thetaSign*np.deg2rad(np.array([this]))) self._matr['cphi0']=self.ERotZ(-self._phiSign*np.deg2rad(np.array([this]))) self._matr['tiltFork']=self.ERotX(np.deg2rad(np.array([this]))) self._matr['zVAX']=self.ERotX(np.deg2rad(np.array([this]))) self._matr['omegaVAX']=self.ERotZ(np.deg2rad(np.array([this]))) # out=self._matr['tilt'][0].dot(self._matr['pan'][0].dot(self._matr['roll'][0])) out=self._matr['ctheta0'][0].dot(out) out.shape=(1,3,3) Loading Loading @@ -348,10 +424,10 @@ while PMatrB[0] is the rotation matrix for the case (45.,0.) and PMatrB[:,2] is self._d['CTHETA_PHI']=CTHETA_PHI # # theta rotation self._matr['CTRL_THETA']=self.ERotY(np.deg2rad(CTHETA_PHI[:,0])) self._matr['CTRL_THETA']=self.ERotY(self._thetaSign*np.deg2rad(CTHETA_PHI[:,0])) # # phi rotation self._matr['CTRL_PHI']=self.ERotZ(np.deg2rad(CTHETA_PHI[:,1])) self._matr['CTRL_PHI']=self.ERotZ(self._phiSign*np.deg2rad(CTHETA_PHI[:,1])) # # apply each theta rotation to M1 out=[k.dot(self._matr['M1'][0]) for k in self._matr['CTRL_THETA']] Loading