Macro for horizontal focusing motor corrections

From 26-ID
Jump to navigationJump to search

Back to X-Ray Microscopy


The following macro resides on desprez.cnm.aps.anl.gov in the directory /home/user26id/spec/local_macros/hm.mac :

def hm_config (mne,type,unit,module,chan) ' {

   if (type == "mot" )
         return "hzi hzo hxm"

}'

def hm_calc(mne,mode) ' {

   if (mode == 0 ) {
          if (mne == hx)
              A[mne] = A[hxm]*cos(atan((A[hzi]-A[hzo])*0.5/39.96))+(24.5+1.27+0.01627)*sin(atan((A[hzi]-A[hzo])/(2*39.96)))-16.463*pow(atan((A[hzi]-A[hzo])*0.5/39.96),2);

else if (mne == hth)

              A[mne] =atan((A[hzi]-A[hzo])/(2*39.96))*180/PI;
          else if (mne == hz)
              A[mne] =(24.5+1.27)*cos(atan((A[hzi]-A[hzo])/(2*39.96)))+(A[hzi]+A[hzo])/2-A[hxm]*sin(atan((A[hzi]-A[hzo])/(2*39.96)));
   }	       
         else {

if (mne == hzi ) A[mne] = A[hz]-(24.5+1.27)*cos(A[hth]*PI/180)+39.96*tan(A[hth]*PI/180)+(A[hx]+16.463*pow(A[hth]*PI/180,2)-(24.5+1.27+0.01627)*sin(A[hth]*PI/180))*tan(A[hth]*PI/180);

          else if (mne == hzo )
              A[mne] = A[hz]-(24.5+1.27)*cos(A[hth]*PI/180)-39.96*tan(A[hth]*PI/180)+(A[hx]+16.463*pow(A[hth]*PI/180,2)-(24.5+1.27+0.01627)*sin(A[hth]*PI/180))*tan(A[hth]*PI/180);
         else if (mne == hxm )
              A[mne] = (A[hx]+16.463*pow(A[hth]*PI/180,2))/cos(A[hth]*PI/180)-(24.5+0.75+0.52+0.01627)*tan(A[hth]*PI/180);

} }'