BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
csv Namespace Reference

Typedefs

typedef std::vector< std::vector< std::string > > DataArray
 
typedef std::vector< std::string > DataColumn
 
typedef std::vector< std::string > DataRow
 

Enumerations

enum  ColumnType { _intensity_ , _theta_ , _q_ }
 

Functions

bool isAscii (QString filename)
 

Variables

const QStringList HeaderLabels {"Intensity", "theta", "q"}
 
const QStringList UnitsLabels {"default", "bin", "rad", "deg", "mm", "1/nm"}
 

Typedef Documentation

◆ DataArray

typedef std::vector<std::vector<std::string> > csv::DataArray

Definition at line 26 of file CsvNamespace.h.

◆ DataColumn

typedef std::vector<std::string> csv::DataColumn

Definition at line 28 of file CsvNamespace.h.

◆ DataRow

typedef std::vector<std::string> csv::DataRow

Definition at line 27 of file CsvNamespace.h.

Enumeration Type Documentation

◆ ColumnType

Enumerator
_intensity_ 
_theta_ 
_q_ 

Definition at line 23 of file CsvNamespace.h.

23 { _intensity_, _theta_, _q_ };
@ _q_
Definition: CsvNamespace.h:23
@ _theta_
Definition: CsvNamespace.h:23
@ _intensity_
Definition: CsvNamespace.h:23

Function Documentation

◆ isAscii()

bool csv::isAscii ( QString  filename)

Definition at line 19 of file CsvNamespace.cpp.

20 {
21  return true;
22  // TODO
23  // This function needs to be defined properly (if at all)
24  // motivation: ° and Å characters are problematic.
25  char c;
26  size_t count = 0;
27  size_t count_bad = 0;
28  std::ifstream is(filename.toStdString());
29  while (is.get(c) && count < 1000) {
30  count++;
31  if (size_t(c) > 255)
32  count_bad++;
33  }
34  is.close();
35  double acceptance_threshold = 0.1 * double(count);
36  // std::cout << count << "; " << count_bad << std::endl;
37  return static_cast<double>(count_bad) <= acceptance_threshold;
38 }
std::string filename(const std::string &path)
Returns path without directory part ("Foo/Bar/Doz.int.gz" -> "Doz.int.gz")

References FileSystemUtils::filename().

Here is the call graph for this function:

Variable Documentation

◆ HeaderLabels

const QStringList csv::HeaderLabels {"Intensity", "theta", "q"}

Definition at line 24 of file CsvNamespace.h.

Referenced by CsvImportData::columnLabel().

◆ UnitsLabels

const QStringList csv::UnitsLabels {"default", "bin", "rad", "deg", "mm", "1/nm"}

Definition at line 25 of file CsvNamespace.h.

Referenced by DataSelector::units().