Commit 6e7b50c5 authored by Michele Maris's avatar Michele Maris
Browse files

u

parent 1df8754a
Loading
Loading
Loading
Loading
+35 −19
Original line number Diff line number Diff line
@@ -110,13 +110,13 @@ class ElemRot :
   def __getitem__(self,i,j) :
      return self._m[i,j]
   def __setitem__(self,i,j,this) :
      return self._m[i,j]=this
      self._m[i,j]=this
   def copy(self) :
      import copy
      return copy.deepcopy(self)
   def __rmul__(self,this) :
      if this.__class__==self.__class__ :
         out=np.zeros([3,3,max(len(self),len(this))]
         out=np.zeros([3,3,max(len(self),len(this))])
         for i in range(3) :
            for j in range(3) :
               for l in range(3) :
@@ -133,7 +133,7 @@ class PRM0 :
   @roll.setter
   def roll(self,this) :
      self._d['roll']=this
      self._map['roll']=1
      self._mark['roll']=1
      self._matr['roll']=self.MatrZ(np.deg2rad(np.array([this])))
      self._isComplete=False
   #
@@ -143,7 +143,7 @@ class PRM0 :
   @pan.setter
   def pan(self,this) :
      self._d['pan']=this
      self._map['pan']=1
      self._mark['pan']=1
      self._matr['pan']=self.MatrY(np.deg2rad(np.array([this])))
      self._isComplete=False
   #
@@ -153,7 +153,7 @@ class PRM0 :
   @tilt.setter
   def tilt(self,this) :
      self._d['tilt']=this
      self._map['tilt']=1
      self._mark['tilt']=1
      self._matr['tilt']=self.MatrX(np.deg2rad(np.array([this])))
      self._isComplete=False
   #
@@ -163,7 +163,7 @@ class PRM0 :
   @ctheta0.setter
   def ctheta0(self,this) :
      self._d['ctheta0']=this
      self._map['ctheta0']=1
      self._mark['ctheta0']=1
      self._matr['ctheta0']=self.MatrY(-np.deg2rad(np.array([this])))
      self._isComplete=False
   #
@@ -173,7 +173,7 @@ class PRM0 :
   @cphi0.setter
   def cphi0(self,this) :
      self._d['cphi0']=this
      self._map['cphi0']=1
      self._mark['cphi0']=1
      self._matr['cphi0']=self.MatrZ(-np.deg2rad(np.array([this])))
      self._isComplete=False
   #
@@ -183,7 +183,7 @@ class PRM0 :
   @tiltFork.setter
   def tiltFork(self,this) :
      self._d['tiltFork']=this
      self._map['tiltFork']=1
      self._mark['tiltFork']=1
      self._matr['tiltFork']=self.MatrX(np.deg2rad(np.array([this])))
      self._isComplete=False
   #
@@ -193,7 +193,7 @@ class PRM0 :
   @zVax.setter
   def zVax(self,this) :
      self._d['zVax']=this
      self._map['zVax']=1
      self._mark['zVax']=1
      self._matr['zVax']=self.MatrX(np.deg2rad(np.array([this])))
      self._isComplete=False
   #
@@ -203,7 +203,7 @@ class PRM0 :
   @omegaVax.setter
   def omegaVax(self,this) :
      self._d['omegaVax']=this
      self._map['omegaVax']=1
      self._mark['omegaVax']=1
      self._matr['omegaVax']=self.MatrZ(np.deg2rad(np.array([this])))
      self._isComplete=False
   #
@@ -211,6 +211,13 @@ class PRM0 :
   def isComplete(self) :
      return self._isComplete
   #
   @property
   def isAllSet(self) :
      for k in self.keys() :
         if self._mark[k]==0 :
            return False
      return True
   #
   def keys(self) :
      return ['roll','pan','tilt','ctheta0','cphi0','tiltFork','zVax','omegaVax']
   #
@@ -224,7 +231,7 @@ class PRM0 :
      import copy
      return copy.deepcopy(self)
   #
   def __init__(self) :
   def __init__(self,ideal=False) :
      self._isComplete=False
      self._d={}
      for k in self.keys() :
@@ -235,12 +242,18 @@ class PRM0 :
      self._matr={}
      for k in self.keys() :
         self._matr[k]=None
      if ideal :
         self.setIdeal()
   #
   def isAllSet(self) :
      for k in self.keys() :
         if self._mark[k]==0 :
            return False
      return True
   def setIdeal(self) :
      self.roll=0.
      self.pan=0.
      self.tilt=0.
      self.tiltFork=0.
      self.zVax=0.
      self.omegaVax=0.
      self.cphi0=0.
      self.ctheta0=0.
   #
   def commit(self) :
      if self.isAllSet :
@@ -304,11 +317,11 @@ while PMatrB[0] is the rotation matrix for the case (45.,0.) and PMatrB[:,2] is
         raise Error('Configuration not completed or not committed','')
      #
      self._matr['CTRL_THETA']=self.MatrY(np.deg2rad(CTHETA_PHI[:,0]))
      self._matr['CTRL_PHI']=self.MatrZ((np.deg2rad(CTHETA_PHI[:,1]))
      self._matr['CTRL_PHI']=self.MatrZ(np.deg2rad(CTHETA_PHI[:,1]))
      #
      out=self.rmult(self._matr['ALT_ENC'],self.['M1'])
      out=self.rmult(self._matr['CTRL_THETA'],self._matr['M1'])
      out=self.rmult(self._matr['M2'],out)
      out=self.rmult(self._matr['AZ_ENC'],out)
      out=self.rmult(self._matr['CTRL_PHI'],out)
      out=self.rmult(self._matr['M3'],out)
      #
      #stores Rout 
@@ -329,6 +342,7 @@ while PMatrB[0] is the rotation matrix for the case (45.,0.) and PMatrB[:,2] is
      out[1,2]=-s
      out[2,1]=s
      out[2,2]=c
      return out
   #
   def MatrY(self,angle) :
      out=np.zeros([3,3,len(angle)])
@@ -339,6 +353,7 @@ while PMatrB[0] is the rotation matrix for the case (45.,0.) and PMatrB[:,2] is
      out[0,2]=s
      out[2,0]=-s
      out[2,2]=c
      return out
   #
   def MatrZ(self,angle) :
      out=np.zeros([3,3,len(angle)])
@@ -349,6 +364,7 @@ while PMatrB[0] is the rotation matrix for the case (45.,0.) and PMatrB[:,2] is
      out[0,1]=-s
      out[1,0]=s
      out[1,1]=c
      return out
   #
   def rmult(self,this,that) :
      out=np.zeros([3,3,max(this.shape[2],that.shape[2])])