Macro for vertical focusing motor corrections

From CNM Wiki
Revision as of 18:51, April 14, 2009 by Vrose (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump 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/vm.mac :


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

   if (type == "mot" )
         return "vzm vyd vyu vrz vxm"

}'

def vm_calc(mne,mode) ' {

   if (mode == 0 ) {
          if (mne == vy)
              A[mne] =A[vyd]*59.42/61+A[vyu]*1.58/61.0+(0.112+0.6-0.986+0.581-1.555)*atan((A[vyu]-A[vyd])/61.0)-(21.785-3.617+1.34-3.653+1.2506)*pow(atan((A[vyu]-A[vyd])/61.0),2)-(1.948-3.30)*atan(A[vrz]/59.55)-(48.83+0.898)*pow(atan(A[vrz]/59.55),2);
          else if (mne == vth)
              A[mne] = atan((A[vyu]-A[vyd])/61.0)*180/PI;
	   else if (mne == vchi)

A[mne] = atan(A[vrz]/59.55)*180/PI;

	   else if (mne == vz)
              A[mne] = A[vzm]+((A[vyu]-A[vyd])/61.0)*38.6;
	   else if (mne == vx)

A[mne] = A[vxm];

   } else {
          if (mne == vyu )
              A[mne] = A[vy]-(0.112+0.6-0.986+0.581-1.555)*A[vth]*PI/180+(21.785-3.617+1.34-3.653+1.2506)*pow(A[vth]*PI/180,2)+(1.948-3.30)*A[vchi]*PI/180+(48.83+0.898)*pow(A[vchi]*PI/180,2)+tan(A[vth]*PI/180)*59.42;
          else if (mne == vyd )
              A[mne] = A[vy]-(0.112+0.6-0.986+0.581-1.555)*A[vth]*PI/180+(21.785-3.617+1.34-3.653+1.2506)*pow(A[vth]*PI/180,2)+(1.948-3.30)*A[vchi]*PI/180+(48.83+0.898)*pow(A[vchi]*PI/180,2)-tan(A[vth]*PI/180)*1.58;
          else if (mne == vzm )
              A[mne] = A[vz]-tan(A[vth]*PI/180)*38.6;

else if (mne == vrz )

              A[mne] = tan(A[vchi]*PI/180)*59.55;

else if (mne == vxm )

              A[mne] = A[vx];
   }