parameters: (self, ws)
return_statement: return dq_over_q
docstring: Compute the Q resolution from the meta data.
docstring_summary: Compute the Q resolution from the meta data.
docstring_tokens: Compute the Q resolution from the meta data .
function: def compute_resolution(self, ws):
          """
              Compute the Q resolution from the meta data.
          """
          # We can't compute the resolution if the value of xi is not in the logs.
          # Since it was not always logged, check for it here.
          if not ws.getRun().hasProperty("BL4B:Mot:xi.RBV"):
              logger.notice("Could not find BL4B:Mot:xi.RBV: using supplied dQ/Q")
              return None
  
          # Xi reference would be the position of xi if the si slit were to be positioned
          # at the sample. The distance from the sample to si is then xi_reference - xi.
          xi_reference = 445
          if ws.getInstrument().hasParameter("xi-reference"):
              ws.getInstrument().getNumberParameter("xi-reference")[0]
  
          # Distance between the s1 and the sample
          s1_sample_distance = 1485
          if ws.getInstrument().hasParameter("s1-sample-distance"):
              ws.getInstrument().getNumberParameter("s1-sample-distance")[0]
  
          front_slit = self.getProperty("FrontSlitName").value
          s1h = abs(ws.getRun().getProperty("%sVHeight" % front_slit).value[0])
          ths = abs(ws.getRun().getProperty("ths").value[0])
          xi = abs(ws.getRun().getProperty("BL4B:Mot:xi.RBV").value[0])
          sample_si_distance = xi_reference - xi
          slit_distance = s1_sample_distance - sample_si_distance
          dq_over_q = s1h / slit_distance * 180 / 3.1416 / ths
          return dq_over_q
function_tokens: def compute_resolution ( self , ws ) : # We can't compute the resolution if the value of xi is not in the logs. # Since it was not always logged, check for it here. if not ws . getRun ( ) . hasProperty ( "BL4B:Mot:xi.RBV" ) : logger . notice ( "Could not find BL4B:Mot:xi.RBV: using supplied dQ/Q" ) return None # Xi reference would be the position of xi if the si slit were to be positioned # at the sample. The distance from the sample to si is then xi_reference - xi. xi_reference = 445 if ws . getInstrument ( ) . hasParameter ( "xi-reference" ) : ws . getInstrument ( ) . getNumberParameter ( "xi-reference" ) [ 0 ] # Distance between the s1 and the sample s1_sample_distance = 1485 if ws . getInstrument ( ) . hasParameter ( "s1-sample-distance" ) : ws . getInstrument ( ) . getNumberParameter ( "s1-sample-distance" ) [ 0 ] front_slit = self . getProperty ( "FrontSlitName" ) . value s1h = abs ( ws . getRun ( ) . getProperty ( "%sVHeight" % front_slit ) . value [ 0 ] ) ths = abs ( ws . getRun ( ) . getProperty ( "ths" ) . value [ 0 ] ) xi = abs ( ws . getRun ( ) . getProperty ( "BL4B:Mot:xi.RBV" ) . value [ 0 ] ) sample_si_distance = xi_reference - xi slit_distance = s1_sample_distance - sample_si_distance dq_over_q = s1h / slit_distance * 180 / 3.1416 / ths return dq_over_q