Skip to content

Commit

Permalink
Merge branch 'feature/6176_upload_scripts' into feature/6894_responsi…
Browse files Browse the repository at this point in the history
…veness_script_repo

This was necessary to allow us to speed up the interaction with the upload
and fetch the changes on download as well.

re #6894
  • Loading branch information
gesnerpassos committed Apr 26, 2013
2 parents 138288f + f057834 commit cf54c89
Show file tree
Hide file tree
Showing 77 changed files with 2,597 additions and 936 deletions.
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/inc/MantidAPI/Axis.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class MANTID_API_DLL Axis
Kernel::Unit_sptr& unit();

/// Set the unit on the Axis
virtual void setUnit(const std::string & unit);
virtual const Kernel::Unit_sptr& setUnit(const std::string & unitName);

/// Returns true is the axis is a Spectra axis
virtual bool isSpectra() const{return false;}
Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/CoordTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace API
virtual std::string toXMLString() const = 0;
virtual void apply(const coord_t * inputVector, coord_t * outVector) const = 0;
virtual CoordTransform * clone() const = 0;
virtual std::string id() const = 0;

/// Wrapper for VMD
Mantid::Kernel::VMD applyVMD(const Mantid::Kernel::VMD & inputVector) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace Mantid
NullCoordTransform(size_t ndims=3);
virtual ~NullCoordTransform();
std::string toXMLString() const;
std::string id() const;
void apply(const Mantid::coord_t * inputVector, Mantid::coord_t * outVector) const;
virtual CoordTransform * clone() const;

Expand Down
7 changes: 2 additions & 5 deletions Code/Mantid/Framework/API/inc/MantidAPI/ScriptRepository.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,7 @@ They will work as was expected for folders @ref folders-sec.
it it necessary that it identifies who was responsible for changing
the file.
@param description is an optional argument, because, as
explained at @ref script-description-sec it may be already inside the
file. But, if the description is given, it will be inserted to the local
file (if it is a script) or to the README file inside the folder.
@param email An string that identifies the email of the author.
@exception ScriptRepoException may be triggered for an attempt to publish an
Expand All @@ -486,7 +483,7 @@ They will work as was expected for folders @ref folders-sec.
*/
virtual void upload(const std::string & file_path, const std::string & comment,
const std::string & author,
const std::string & description = std::string()) = 0;
const std::string & email) = 0;

/** Define the file patterns that will not be listed in listFiles.
This is important to force the ScriptRepository to not list hidden files,
Expand Down
8 changes: 5 additions & 3 deletions Code/Mantid/Framework/API/src/Axis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ Kernel::Unit_sptr& Axis::unit()
}
/**
* Sets the Unit that is in use on this axis.
* @param unit :: name of the unit as known to the UnitFactory
* @param unitName :: name of the unit as known to the UnitFactory
* @returns The new unit instance
*/
void Axis::setUnit(const std::string & unit)
const Kernel::Unit_sptr& Axis::setUnit(const std::string & unitName)
{
m_unit = Mantid::Kernel::UnitFactory::Instance().create(unit);
m_unit = Mantid::Kernel::UnitFactory::Instance().create(unitName);
return unit();
}

/**
Expand Down
6 changes: 6 additions & 0 deletions Code/Mantid/Framework/API/src/LogManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,12 @@ Kernel::Logger& LogManager::g_log = Kernel::Logger::get("LogManager");
INSTANTIATE(uint32_t);
INSTANTIATE(std::string);
INSTANTIATE(bool);

template MANTID_API_DLL uint16_t LogManager::getPropertyValueAsType(const std::string &) const;
template MANTID_API_DLL std::vector<double> LogManager::getPropertyValueAsType(const std::string &) const;
template MANTID_API_DLL std::vector<size_t> LogManager::getPropertyValueAsType(const std::string &) const;
template MANTID_API_DLL std::vector<int> LogManager::getPropertyValueAsType(const std::string &) const;
template MANTID_API_DLL std::vector<long> LogManager::getPropertyValueAsType(const std::string &) const;
/** @endcond */

} //API namespace
Expand Down
9 changes: 9 additions & 0 deletions Code/Mantid/Framework/API/src/NullCoordTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ namespace Mantid
throw std::runtime_error("Not Implemented");
}

/**
* Coordinate transform id
* @return the type of coordinate transform
*/
std::string NullCoordTransform::id() const
{
return "NullCoordTransform";
}

/**
Apply the transformation.
@param inputVector : pointer to the input vector
Expand Down
38 changes: 38 additions & 0 deletions Code/Mantid/Framework/API/test/ExperimentInfoTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "MantidKernel/DateAndTime.h"
#include "MantidKernel/NexusTestHelper.h"
#include "MantidKernel/SingletonHolder.h"
#include "MantidKernel/Matrix.h"


#include "MantidTestHelpers/ComponentCreationHelper.h"
Expand Down Expand Up @@ -628,6 +629,43 @@ class ExperimentInfoTest : public CxxTest::TestSuite
TS_ASSERT_EQUALS( parameterStr, "" );
}

void testNexus_W_matrix()
{
NexusTestHelper th(true);
th.createFile("ExperimentInfoWMatrixTest.nxs");
ExperimentInfo ei;

DblMatrix WTransf(3,3,true);
// let's add some tricky stuff to w-transf
WTransf[0][1]=0.5;
WTransf[0][2]=2.5;
WTransf[1][0]=10.5;
WTransf[1][2]=12.5;
WTransf[2][0]=20.5;
WTransf[2][1]=21.5;

auto wTrVector = WTransf.getVector();

// this occurs in ConvertToMD, copy methadata
ei.mutableRun().addProperty("W_MATRIX",wTrVector,true);

TS_ASSERT_THROWS_NOTHING(ei.saveExperimentInfoNexus(th.file));

th.reopenFile();

ExperimentInfo other;
std::string InstrParameters;
TS_ASSERT_THROWS_NOTHING(other.loadExperimentInfoNexus(th.file,InstrParameters));

std::vector<double> wMatrRestored=other.run().getPropertyValueAsType<std::vector<double> >("W_MATRIX");

for(int i=0;i<9;i++)
{
TS_ASSERT_DELTA(wTrVector[i],wMatrRestored[i],1.e-9);
}

}

private:

void addInstrumentWithParameter(ExperimentInfo & expt, const std::string & name, const std::string & value)
Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/Framework/Algorithms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ set ( TEST_FILES
ConvertToMatrixWorkspaceTest.h
ConvertToPointDataTest.h
ConvertUnitsTest.h
CopyInstrumentParametersTest.h
CopySampleTest.h
CorrectFlightPathsTest.h
CorrectKiKfTest.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace Algorithms
class DLLExport GenerateEventsFilter : public API::Algorithm
{
public:
GenerateEventsFilter();
explicit GenerateEventsFilter();
virtual ~GenerateEventsFilter();

/// Algorithm's name for identification overriding a virtual method
Expand All @@ -83,34 +83,51 @@ namespace Algorithms
void setFilterByTimeOnly();
void setFilterByLogValue(std::string logname);

void processSingleValueFilter(Kernel::TimeSeriesProperty<double>* mlog, double minvalue, double maxvalue,
void processSingleValueFilter(double minvalue, double maxvalue,
bool filterincrease, bool filterdecrease);

void processMultipleValueFilters(Kernel::TimeSeriesProperty<double>* mlog, double minvalue, double maxvalue,
void processMultipleValueFilters(double minvalue, double maxvalue,
bool filterincrease, bool filterdecrease);

void makeFilterByValue(Kernel::TimeSeriesProperty<double>* mlog,
Kernel::TimeSplitterType& split, double min, double max, double TimeTolerance, bool centre,
void makeFilterByValue(Kernel::TimeSplitterType& split, double min, double max, double TimeTolerance, bool centre,
bool filterIncrease, bool filterDecrease, Kernel::DateAndTime startTime, Kernel::DateAndTime stopTime,
int wsindex);

void makeMultipleFiltersByValues(Kernel::TimeSeriesProperty<double>* mlog,
Kernel::TimeSplitterType& split, std::map<size_t, int> indexwsindexmap, std::vector<double> logvalueranges,
void makeMultipleFiltersByValues(Kernel::TimeSplitterType& split, std::map<size_t, int> indexwsindexmap, std::vector<double> logvalueranges,
bool centre, bool filterIncrease, bool filterDecrease, Kernel::DateAndTime startTime, Kernel::DateAndTime stopTime);

void processIntegerValueFilter(Kernel::TimeSplitterType &splitters, int minvalue, int maxvalue,
bool filterIncrease, bool filterDecrease, Kernel::DateAndTime runend);

size_t searchValue(std::vector<double> sorteddata, double value);

DataObjects::EventWorkspace_const_sptr mEventWS;
API::ISplittersWorkspace_sptr mSplitters;
API::ITableWorkspace_sptr mFilterInfoWS;
DataObjects::EventWorkspace_const_sptr m_dataWS;
API::ISplittersWorkspace_sptr m_splitWS;
API::ITableWorkspace_sptr m_filterInfoWS;

Kernel::DateAndTime mStartTime;
Kernel::DateAndTime mStopTime;

double m_convertfactor;
double m_timeUnitConvertFactor;

Kernel::TimeSeriesProperty<double>* m_dblLog;
Kernel::TimeSeriesProperty<int>* m_intLog;

bool m_logAtCentre;
double m_logTimeTolerance;

};

/** Generate a new time splitter and add to a list of splitters
*/
void make_splitter(Kernel::DateAndTime start, Kernel::DateAndTime stop, int group, Kernel::time_duration tolerance,
Kernel::TimeSplitterType& splitters)
{
Kernel::SplittingInterval newsplit(start - tolerance, stop - tolerance, group);
splitters.push_back(newsplit);

return;
}

} // namespace Algorithms
} // namespace Mantid
Expand Down

0 comments on commit cf54c89

Please sign in to comment.