Skip to content

Commit

Permalink
refs #8026 Redefined isPowder function to check transformation mode
Browse files Browse the repository at this point in the history
and more spelling errors.
  • Loading branch information
abuts committed May 1, 2014
1 parent 9f57e00 commit fe158e3
Show file tree
Hide file tree
Showing 6 changed files with 362 additions and 353 deletions.
8 changes: 4 additions & 4 deletions Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDParent.cpp
Expand Up @@ -50,7 +50,7 @@ void ConvertToMDParent::init()


std::vector<std::string> Q_modes = MDEvents::MDTransfFactory::Instance().getKeys();
// something to do with different moments of thime when algorithm or test loads library. To avoid empty factory always do this.
// something to do with different moments of time when algorithm or test loads library. To avoid empty factory always do this.
if(Q_modes.empty()) Q_modes.assign(1,"ERROR IN LOADING Q-converters");

/// this variable describes default possible ID-s for Q-dimensions
Expand All @@ -59,10 +59,10 @@ void ConvertToMDParent::init()
"There are 3 modes currently available and described in details on [[MD Transformation factory]] page. \n"
"The modes names are '''CopyToMD''', '''mod<nowiki>|Q|</nowiki>''' and '''Q3D'''",
Direction::InOut);
/// temporary, untill dEMode is not properly defined on Workspace
/// temporary, until dEMode is not properly defined on Workspace
std::vector<std::string> dE_modes = Kernel::DeltaEMode().availableTypes();
declareProperty("dEAnalysisMode",dE_modes[Kernel::DeltaEMode::Direct],boost::make_shared<StringListValidator>(dE_modes),
"You can analyse neutron energy transfer in '''Direct''', '''Indirect''' or '''Elastic''' mode. \n"
"You can analyze neutron energy transfer in '''Direct''', '''Indirect''' or '''Elastic''' mode. \n"
"The analysis mode has to correspond to experimental set up. Selecting inelastic mode increases \n"
"the number of the target workspace dimensions by one. See [[MD Transformation factory]] for further details.",
Direction::InOut);
Expand Down Expand Up @@ -104,7 +104,7 @@ void ConvertToMDParent::init()
"The name of the table workspace where the part of the detectors transformation into reciprocal space, "
"calculated by [[PreprocessDetectorsToMD]] algorithm stored. If the workspace is not found in analysis "
"data service, [[PreprocessDetectorsToMD]] used to calculate it. If found, the algorithm uses existing "
"workspace. The field is useful if one expects to analyse number of different experiments obtained on "
"workspace. The field is useful if one expects to analyze number of different experiments obtained on "
"the same instrument. <span style=\"color:#FF0000\"> Dangerous if one uses number of workspaces with "
"modified derived instrument one after another. </span> '''In this case this property has to be set to "
"<span style=\"color:#FF0000\">\"-\"</span> sting (without quotes) or empty (possible from script only) "
Expand Down
Expand Up @@ -10,7 +10,7 @@
* The second operation that this macro performs is to provide the definition
* of the unitID method for the concrete unit.
* Second macro does the same thing as the first one, but allow to regirster the transformation
* Second macro does the same thing as the first one, but allow to register the transformation
* with a name, different form the class name and specified by the transformation ID.
*/
#define DECLARE_MD_TRANSF(classname) \
Expand Down Expand Up @@ -106,12 +106,12 @@ class MANTID_MDEVENTS_DLL MDTransfFactoryImpl : public Kernel::DynamicFactory<MD
mutable std::map< std::string, boost::shared_ptr<MDTransfInterface> > m_createdTransf;
};

///Forward declaration of a specialisation of SingletonHolder for AlgorithmFactoryImpl (needed for dllexport/dllimport) .
///Forward declaration of a specialization of SingletonHolder for AlgorithmFactoryImpl (needed for dllexport/dllimport) .
#ifdef _WIN32
// this breaks new namespace declaraion rules; need to find a better fix
// this breaks new namespace declaration rules; need to find a better fix
template class MANTID_MDEVENTS_DLL Mantid::Kernel::SingletonHolder<MDTransfFactoryImpl>;
#endif /* _WIN32 */
/// The specialisation of the SingletonHolder class that holds the MDTransformations Factory
/// The specialization of the SingletonHolder class that holds the MDTransformations Factory
typedef Kernel::SingletonHolder<MDTransfFactoryImpl> MDTransfFactory;

} // namespace MDEvents
Expand Down
Expand Up @@ -16,21 +16,21 @@ namespace MDEvents
* See http://www.mantidproject.org/Writing_custom_ConvertTo_MD_transformation for detailed description of this
* class place in the algorithms hierarchy.
*
* The inferface provide information for two tasks.
* The interface provide information for two tasks.
* 1) Definition of target MD workspace properties and
* 2) Calculation of MD coordinates for single measurement
1) First task resolved during algorithm initialization and defines the number of dimensions, coordinate system, dimension units and ID-s etc.
This information is used when creating the target MD workspace or checking if existing MD workspace can be used as target for the selected ChildAlgorithm
2) Second task performed during conversion itself. The subclass will works with input workpsace and convert a single point of the input ws into
2) Second task performed during conversion itself. The subclass will works with input workspace and convert a single point of the input ws into
the vector of MD coordinates.
* MD coordinates are stored in the vector of n-dimensions*
* Usual transformation occurs in 4 stages
*
* 1) Initiate the transformation itself.
* 2) set-up, calculation and copying generic multidimensional variables which are not depenent on data (logs)
* 2) set-up, calculation and copying generic multidimensional variables which are not dependent on data (logs)
* 3) set-up, calculation and copying the multidimensional variables which dependent on detectors id only
* 4) calculation of the multidimensional variables which depend on the data along x-axis of the workspace
* and possibly on detectors parameters (values along y-axis)
Expand Down Expand Up @@ -68,9 +68,9 @@ class MDTransfInterface
if the transformation indeed can do the energy analysis */
virtual std::vector<std::string> getEmodes()const{return std::vector<std::string>(1,std::string("Undefined"));}

//***************> the method below involwed in the calculations of MD coordinates
//***************> the method below involved in the calculations of MD coordinates
/** Method deployed out of the loop and calculates all variables needed within the loop.
* In addition it calculates the property-dependant coordinates, which do not depend on workspace
* In addition it calculates the property-dependent coordinates, which do not depend on workspace
*
* @param Coord -- vector of ND-coordinates.
* Method calculates ChildAlgorithm specific number of variables,
Expand Down Expand Up @@ -100,7 +100,7 @@ class MDTransfInterface
* @param err -- error value which can change or remain unchanged depending on MD coordinates or can affect MD coordinates
* @return true -- if all Coord are within the range requested by algorithm. false otherwise
*
* in most existing algorighms X does not depend on Y coordinate, so we can place generalization here;
* in most existing algorithms X does not depend on Y coordinate, so we can place generalization here;
* It should be overridden if the dependence on Y coordinate do exist.
*/
virtual bool calcMatrixCoordinates(const MantidVec& X,size_t i,size_t j,std::vector<coord_t> &Coord, double &s,double &err)const
Expand All @@ -111,7 +111,7 @@ class MDTransfInterface
}

/** The method to calculate all remaining coordinates, defined within the inner loop
* given that the input described by sinble value only
* given that the input described by single value only
* @param X -- X workspace value
*
* @param Coord -- ChildAlgorithm specific number of coordinates, placed in the proper position of the Coordinate vector
Expand All @@ -129,19 +129,19 @@ class MDTransfInterface
/** set up transformation from the class, which can provide all variables necessary for the conversion */
virtual void initialize(const MDWSDescription &)=0;

/** method returns the vector of input coordinates values where the transformed coordinates reach its extremum values in any of its
/** method returns the vector of input coordinates values where the transformed coordinates reach its extreme values in any of its
* transformed directions.
*
* @param xMin -- minimal value of input coordinate
* @param xMax -- maximal value of input coordinate
* These coordinates are always an exteme points and are included into output
* @param det_num -- number of the instrument detector -- some transformatins extreme point depend on a detector number
* These coordinates are always an extreme points and are included into output
* @param det_num -- number of the instrument detector -- some transformations extreme point depend on a detector number
* (e.g. inelastic |Q| transformation)
*/
virtual std::vector<double> getExtremumPoints(const double xMin, const double xMax,size_t det_num)const = 0;

//***************> the methods below are mainly involved in defining the target workspace properties.
// Thay also can be involwed in the preparation to calculations of MD coordinates
// They also can be involved in the preparation to calculations of MD coordinates
// WARNING!!!! THESE METHODS ARE USED BEFORE INITIALIZE IS EXECUTED SO THEY CAN NOT RELY ON THE CONTENTS OF THE CLASS TO BE DEFINED (THEY ARE VIRTUAL STATIC METHODS)

/** returns the unit ID for the input units, the particular transformation expects.
Expand Down
Expand Up @@ -94,7 +94,7 @@ namespace MDEvents
API::MatrixWorkspace_const_sptr getInWS()const{return m_InWS;}
void setWS(API::MatrixWorkspace_sptr otherMatrixWS);
std::string getWSName()const{return m_InWS->name();}
bool isPowder()const{return !m_InWS->sample().hasOrientedLattice();}
bool isPowder()const;
bool hasLattice()const{return m_InWS->sample().hasOrientedLattice();}

boost::shared_ptr<Geometry::OrientedLattice> getLattice()const{return getOrientedLattice(m_InWS);}
Expand Down
22 changes: 11 additions & 11 deletions Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp
Expand Up @@ -10,8 +10,8 @@ namespace Mantid

/**method calculates the units, the transformation expects the input ws to be in. If the input ws is in different units,
the WS data will be converted into the requested units on the fly.
@param dEmode -- energy conversion mode requested by the user for the transfromation
@param inWS -- imput matrix workspace, the subject of transformation.
@param dEmode -- energy conversion mode requested by the user for the transformation
@param inWS -- input matrix workspace, the subject of transformation.
*/
const std::string MDTransfModQ::inputUnitID(Kernel::DeltaEMode::Type dEmode, API::MatrixWorkspace_const_sptr inWS)const
{
Expand All @@ -28,8 +28,8 @@ namespace Mantid

/** method returns number of matrix dimensions calculated by this class
* as function of the energy analysis (conversion) mode
@param mode -- energy conversion mode requested by the user for the transfromation
@param inWS -- imput matrix workspace, the subject of transformation.
@param mode -- energy conversion mode requested by the user for the transformation
@param inWS -- input matrix workspace, the subject of transformation.
*/
unsigned int MDTransfModQ::getNMatrixDimensions(Kernel::DeltaEMode::Type mode,API::MatrixWorkspace_const_sptr inWS)const
{
Expand All @@ -39,14 +39,14 @@ namespace Mantid
case(Kernel::DeltaEMode::Direct): return 2;
case(Kernel::DeltaEMode::Indirect):return 2;
case(Kernel::DeltaEMode::Elastic): return 1;
default: throw(std::invalid_argument("Unknow or unsupported energy conversion mode"));
default: throw(std::invalid_argument("Unknown or unsupported energy conversion mode"));
}
}


/**Convert single point of matrix workspace into reciprocal space and (optionally) modify signal and error
as function of reciprocal space (e.g. Lorents corrections)
@param x -- the x-coordinate of matix workspace. Often can be a time of flight though the unit conversion is availible
@param x -- the x-coordinate of matrix workspace. Often can be a time of flight though the unit conversion is available
@param Coord -- converted MD coordinates of the point x calculated for particular workspace position (detector)
@param signal -- the signal in the point
Expand All @@ -68,7 +68,7 @@ namespace Mantid
}
}

/** Method fills-in all additional properties requested by user and not defined by matrix workspace itselt.
/** Method fills-in all additional properties requested by user and not defined by matrix workspace itself.
* it fills in [nd - (1 or 2 -- depending on emode)] values into Coord vector;
*
*@param Coord -- input-output vector of MD-coordinates
Expand Down Expand Up @@ -197,7 +197,7 @@ namespace Mantid
* direction.
*
* @param eMin -- minimal momentum (in elastic mode) or energy transfer (in inelastic) for the transformation
* @param eMax -- maxumal momentum (in elastic mode) or energy transfer (in inelastic) for the transformation
* @param eMax -- maximal momentum (in elastic mode) or energy transfer (in inelastic) for the transformation
* @param det_num -- number of the instrument detector for the transformation
*/
std::vector<double> MDTransfModQ::getExtremumPoints(const double eMin, const double eMax,size_t det_num)const
Expand Down Expand Up @@ -244,7 +244,7 @@ namespace Mantid
}


/** function initalizes all variables necessary for converting workspace variables into MD variables in ModQ (elastic/inelastic) cases */
/** function initializes all variables necessary for converting workspace variables into MD variables in ModQ (elastic/inelastic) cases */
void MDTransfModQ::initialize(const MDWSDescription &ConvParams)
{
//********** Generic part of initialization, common for elastic and inelastic modes:
Expand Down Expand Up @@ -305,7 +305,7 @@ namespace Mantid
m_pDetMasks = ConvParams.m_PreprDetTable->getColDataArray<int>("detMask");
}
/**method returns default ID-s for ModQ elastic and inelastic modes. The ID-s are related to the units,
* this class produces its ouptut in.
* this class produces its output in.
*@param dEmode -- energy conversion mode
*@param inWS -- Input Matrix workspace
Expand Down Expand Up @@ -339,7 +339,7 @@ namespace Mantid
}


/**function returns units ID-s which this transformation prodiuces its ouptut.
/**function returns units ID-s which this transformation produces its output.
* @param dEmode -- energy conversion mode
* @param inWS -- Input Matrix workspace
*
Expand Down

0 comments on commit fe158e3

Please sign in to comment.