Skip to content

Commit

Permalink
Made Basic changes to headers and loadascii2's cpp
Browse files Browse the repository at this point in the history
Changed thigns like the version, author etc. no actual functional changes

Refs #7732
  • Loading branch information
keithnbrown committed Oct 11, 2013
1 parent f642118 commit 8366bd0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 35 deletions.
@@ -1,5 +1,5 @@
#ifndef MANTID_DATAHANDLING_LOADASCII_H_
#define MANTID_DATAHANDLING_LOADASCII_H_
#ifndef MANTID_DATAHANDLING_LoadAscii2_H_
#define MANTID_DATAHANDLING_LoadAscii2_H_

//----------------------------------------------------------------------
// Includes
Expand All @@ -21,8 +21,8 @@ namespace Mantid
<li>Unit - the unit to assign to the X axis (default: Energy).</li>
</ul>
@author Roman Tolchenov, Tessella plc
@date 3/07/09
@author Keith Brown, ISIS, Placement student from the University of Derby
@date 10/10/13
Copyright &copy; 2007-2010 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
Expand All @@ -44,15 +44,15 @@ namespace Mantid
File change history is stored at: <https://github.com/mantidproject/mantid>.
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport LoadAscii :public API::IFileLoader<Kernel::FileDescriptor>
class DLLExport LoadAscii2 :public API::IFileLoader<Kernel::FileDescriptor>
{
public:
/// Default constructor
LoadAscii();
LoadAscii2();
/// The name of the algorithm
virtual const std::string name() const { return "LoadAscii"; }
/// The version number
virtual int version() const { return 1; }
virtual int version() const { return 2; }
/// The category
virtual const std::string category() const { return "DataHandling\\Text"; }
/// Returns a confidence value that this algorithm can load a file
Expand Down Expand Up @@ -93,4 +93,4 @@ namespace Mantid
} // namespace DataHandling
} // namespace Mantid

#endif /* MANTID_DATAHANDLING_LOADASCII_H_ */
#endif /* MANTID_DATAHANDLING_LoadAscii2_H_ */
@@ -1,5 +1,5 @@
#ifndef MANTID_DATAHANDLING_SAVEASCII_H_
#define MANTID_DATAHANDLING_SAVEASCII_H_
#ifndef MANTID_DATAHANDLING_SaveAscii2_H_
#define MANTID_DATAHANDLING_SaveAscii2_H_

//----------------------------------------------------------------------
// Includes
Expand All @@ -10,7 +10,7 @@ namespace Mantid
{
namespace DataHandling
{
/** @class SaveAscii SaveAscii.h DataHandling/SaveAscii.h
/** @class SaveAscii2 SaveAscii2.h DataHandling/SaveAscii2.h
Saves a workspace or selected spectra in a coma-separated ascii file. Spectra are saved in columns.
Properties:
Expand All @@ -24,8 +24,8 @@ namespace Mantid
</ul>
@author Roman Tolchenov, Tessella plc
@date 3/07/09
@author Keith Brown, ISIS, Placement student from the University of Derby
@date 10/10/13
Copyright &copy; 2007-9 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
Expand All @@ -47,17 +47,17 @@ namespace Mantid
File change history is stored at: <https://github.com/mantidproject/mantid>.
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport SaveAscii : public API::Algorithm
class DLLExport SaveAscii2 : public API::Algorithm
{
public:
/// Default constructor
SaveAscii();
SaveAscii2();
/// Destructor
~SaveAscii() {}
~SaveAscii2() {}
/// Algorithm's name for identification overriding a virtual method
virtual const std::string name() const { return "SaveAscii"; }
/// Algorithm's version for identification overriding a virtual method
virtual int version() const { return 1; }
virtual int version() const { return 2; }
/// Algorithm's category for identification overriding a virtual method
virtual const std::string category() const { return "DataHandling\\Text"; }

Expand All @@ -78,4 +78,4 @@ namespace Mantid
} // namespace DataHandling
} // namespace Mantid

#endif /* MANTID_DATAHANDLING_SAVEASCII_H_ */
#endif /* MANTID_DATAHANDLING_SaveAscii2_H_ */
34 changes: 17 additions & 17 deletions Code/Mantid/Framework/DataHandling/src/LoadAscii2.cpp
@@ -1,6 +1,6 @@
/*WIKI*
The LoadAscii algorithm reads in spectra data from a text file and stores it in a [[Workspace2D]] as data points. The data in the file must be organized in columns separated by commas, tabs, spaces, colons or semicolons. Only one separator type can be used throughout the file; use the "Separator" property to tell the algorithm which to use. The algorithm [[SaveAscii]] is normally able to produce such a file.
The LoadAscii2 algorithm reads in spectra data from a text file and stores it in a [[Workspace2D]] as data points. The data in the file must be organized in columns separated by commas, tabs, spaces, colons or semicolons. Only one separator type can be used throughout the file; use the "Separator" property to tell the algorithm which to use. The algorithm [[SaveAscii2]] is normally able to produce such a file.
By default the algorithm attempts to guess which lines are header lines by trying to see where a contiguous block of numbers starts. This can be turned off by specifying the "SkipNumLines" property, which will then tell the algorithm to simply use that as the the number of header lines.
Expand All @@ -13,14 +13,14 @@ The number of bins is defined by the number of rows.
The resulting workspace will have common X binning for all spectra.
This algorithm cannot load a file created by [[SaveAscii]] if it has X errors written and several spectra.
This algorithm cannot load a file created by [[SaveAscii2]] if it has X errors written and several spectra.
*WIKI*/
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidDataHandling/LoadAscii.h"
#include "MantidDataHandling/LoadAscii2.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidKernel/UnitFactory.h"
#include "MantidAPI/FileProperty.h"
Expand All @@ -38,10 +38,10 @@ namespace Mantid
{
namespace DataHandling
{
DECLARE_FILELOADER_ALGORITHM(LoadAscii);
DECLARE_FILELOADER_ALGORITHM(LoadAscii2);

/// Sets documentation strings for this algorithm
void LoadAscii::initDocs()
void LoadAscii2::initDocs()
{
this->setWikiSummary("Loads data from a text file and stores it in a 2D [[workspace]] ([[Workspace2D]] class). ");
this->setOptionalMessage("Loads data from a text file and stores it in a 2D workspace (Workspace2D class).");
Expand All @@ -52,7 +52,7 @@ namespace Mantid
using namespace API;

/// Empty constructor
LoadAscii::LoadAscii() : m_columnSep(), m_separatorIndex()
LoadAscii2::LoadAscii2() : m_columnSep(), m_separatorIndex()
{
}

Expand All @@ -61,7 +61,7 @@ namespace Mantid
* @param descriptor A descriptor for the file
* @returns An integer specifying the confidence level. 0 indicates it will not be used
*/
int LoadAscii::confidence(Kernel::FileDescriptor & descriptor) const
int LoadAscii2::confidence(Kernel::FileDescriptor & descriptor) const
{
const std::string & filePath = descriptor.filename();
const size_t filenameLength = filePath.size();
Expand All @@ -86,7 +86,7 @@ namespace Mantid
* @param file :: The file pointer
* @returns true if the file an ascii text file, false otherwise
*/
bool LoadAscii::isAscii(FILE *file)
bool LoadAscii2::isAscii(FILE *file)
{
char data[256];
char *pend = &data[fread(data, 1, sizeof(data), file)];
Expand Down Expand Up @@ -114,7 +114,7 @@ namespace Mantid
* Process the header information. This implementation just skips it entirely.
* @param file :: A reference to the file stream
*/
void LoadAscii::processHeader(std::ifstream & file) const
void LoadAscii2::processHeader(std::ifstream & file) const
{

// Most files will have some sort of header. If we've haven't been told how many lines to
Expand Down Expand Up @@ -189,7 +189,7 @@ namespace Mantid
* @param file :: A reference to a file stream
* @returns A pointer to a new workspace
*/
API::Workspace_sptr LoadAscii::readData(std::ifstream & file) const
API::Workspace_sptr LoadAscii2::readData(std::ifstream & file) const
{
// Get the first line and find the number of spectra from the number of columns
std::string line;
Expand Down Expand Up @@ -227,7 +227,7 @@ namespace Mantid
else
{
g_log.error() << "Invalid data format found in file \"" << getPropertyValue("Filename") << "\"\n";
g_log.error() << "LoadAscii requires the number of columns to be an even multiple of either 2 or 3.";
g_log.error() << "LoadAscii2 requires the number of columns to be an even multiple of either 2 or 3.";
throw std::runtime_error("Invalid data format.");
}

Expand Down Expand Up @@ -309,7 +309,7 @@ namespace Mantid
/**
* Peek at a line without extracting it from the stream
*/
void LoadAscii::peekLine(std::ifstream & is, std::string & str) const
void LoadAscii2::peekLine(std::ifstream & is, std::string & str) const
{
getline(is, str);
is.seekg(-(int)str.length(),std::ios::cur);
Expand All @@ -321,7 +321,7 @@ namespace Mantid
* @param line :: The line to be checked
* @return True if the line should be skipped
*/
bool LoadAscii::skipLine(const std::string & line) const
bool LoadAscii2::skipLine(const std::string & line) const
{
// Empty or comment
return ( line.empty() || boost::starts_with(line, "#") );
Expand All @@ -333,7 +333,7 @@ namespace Mantid
* @param[in] str :: The input string
* @returns The number of columns
*/
int LoadAscii::splitIntoColumns(std::list<std::string> & columns, const std::string & str) const
int LoadAscii2::splitIntoColumns(std::list<std::string> & columns, const std::string & str) const
{
boost::split(columns, str, boost::is_any_of(m_columnSep), boost::token_compress_on);
return static_cast<int>(columns.size());
Expand All @@ -344,7 +344,7 @@ namespace Mantid
* @param[out] values :: The data vector fill
* @param columns :: The list of strings denoting columns
*/
void LoadAscii::fillInputValues(std::vector<double> &values,
void LoadAscii2::fillInputValues(std::vector<double> &values,
const std::list<std::string>& columns) const
{
values.resize(columns.size());
Expand Down Expand Up @@ -373,7 +373,7 @@ namespace Mantid
// Private methods
//--------------------------------------------------------------------------
/// Initialisation method.
void LoadAscii::init()
void LoadAscii2::init()
{
std::vector<std::string> exts;
exts.push_back(".dat");
Expand Down Expand Up @@ -414,7 +414,7 @@ namespace Mantid
/**
* Executes the algorithm.
*/
void LoadAscii::exec()
void LoadAscii2::exec()
{
std::string filename = getProperty("Filename");
std::ifstream file(filename.c_str());
Expand Down

0 comments on commit 8366bd0

Please sign in to comment.