Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas White
pinkindexer
Commits
f1827cdd
Commit
f1827cdd
authored
Feb 04, 2019
by
Yaroslav Gevorkov
Browse files
hiding things behind the pinkIndexer namespace
parent
a6547fce
Changes
40
Show whitespace changes
Inline
Side-by-side
include/Backprojection.h
View file @
f1827cdd
#pragma once
#pragma once
#include
<Eigen/Dense>
#include
"ExperimentSettings.h"
#include
"ExperimentSettings.h"
#include
<Eigen/Dense>
class
Backprojection
namespace
pinkIndexer
{
{
class
Backprojection
{
public:
public:
Backprojection
(
const
ExperimentSettings
&
experimentSettings
);
Backprojection
(
const
ExperimentSettings
&
experimentSettings
);
void
backProject
(
const
Eigen
::
Matrix2Xf
&
detectorPeaks_m
,
Eigen
::
Matrix3Xf
&
ucsDirections
,
Eigen
::
Array2Xf
&
ucsBorderNorms
)
const
;
void
backProject
(
const
Eigen
::
Matrix2Xf
&
detectorPeaks_m
,
Eigen
::
Matrix3Xf
&
ucsDirections
,
Eigen
::
Array2Xf
&
ucsBorderNorms
)
const
;
private:
private:
ExperimentSettings
experimentSettings
;
ExperimentSettings
experimentSettings
;
};
};
\ No newline at end of file
}
// namespace pinkIndexer
\ No newline at end of file
include/BadInputException.h
View file @
f1827cdd
...
@@ -10,20 +10,19 @@
...
@@ -10,20 +10,19 @@
#include
<CustomException.h>
#include
<CustomException.h>
//! A specialization of MyException.
namespace
pinkIndexer
/*!
{
* This exception is thrown whenever the input to a method/function is not as expected
*/
class
BadInputException
:
public
CustomException
{
public:
BadInputException
(
const
std
::
string
&
msg
)
:
CustomException
(
msg
)
{
}
virtual
~
BadInputException
()
throw
()
class
BadInputException
:
public
CustomException
{
public:
BadInputException
(
const
std
::
string
&
msg
)
:
CustomException
(
msg
)
{
{
}
}
};
virtual
~
BadInputException
()
throw
()
{}
};
}
// namespace pinkIndexer
#endif
/* BADINPUTEXCEPTION_H_ */
#endif
/* BADINPUTEXCEPTION_H_ */
include/Chronometer.h
View file @
f1827cdd
...
@@ -4,9 +4,11 @@
...
@@ -4,9 +4,11 @@
#include
<cstdint>
#include
<cstdint>
#include
<string>
#include
<string>
class
Chronomet
er
namespace
pinkIndex
er
{
{
public:
class
Chronometer
{
public:
/**
/**
* @brief Chronometer constructor - saves the current time
* @brief Chronometer constructor - saves the current time
* @param key the key for the debug protocol value
* @param key the key for the debug protocol value
...
@@ -18,9 +20,10 @@ public:
...
@@ -18,9 +20,10 @@ public:
*/
*/
~
Chronometer
();
~
Chronometer
();
private:
private:
/// the key for the time value
/// the key for the time value
const
std
::
string
key_
;
const
std
::
string
key_
;
/// the timestamp at object construction
/// the timestamp at object construction
std
::
chrono
::
time_point
<
std
::
chrono
::
system_clock
>
startTime_
;
std
::
chrono
::
time_point
<
std
::
chrono
::
system_clock
>
startTime_
;
};
};
}
// namespace pinkIndexer
\ No newline at end of file
include/CustomException.h
View file @
f1827cdd
...
@@ -11,40 +11,43 @@
...
@@ -11,40 +11,43 @@
#include
<exception>
#include
<exception>
#include
<string>
#include
<string>
//! The Exception class from which every exception type in this project inherits from.
namespace
pinkIndexer
/*!
{
//! The Exception class from which every exception type in this project inherits from.
/*!
* This is the superclass for all the custom exception types used in this project.
* This is the superclass for all the custom exception types used in this project.
* This class itself inherits from std::exception.
* This class itself inherits from std::exception.
*/
*/
class
CustomException
:
public
std
::
exception
{
class
CustomException
:
public
std
::
exception
public:
{
public:
/*!
/*!
* The constructor taking a message as parameter.
* The constructor taking a message as parameter.
* @param msg The message of the exception.
* @param msg The message of the exception.
*/
*/
CustomException
(
const
std
::
string
&
msg
)
:
CustomException
(
const
std
::
string
&
msg
)
msg
(
msg
)
:
msg
(
msg
)
{
{
}
}
/*!
/*!
* The virtual destructor.
* The virtual destructor.
*/
*/
virtual
~
CustomException
()
throw
()
virtual
~
CustomException
()
throw
()
{}
{
}
/*!
/*!
* Returns the message of the exception.
* Returns the message of the exception.
* @return
* @return
*/
*/
virtual
const
char
*
what
()
const
throw
()
virtual
const
char
*
what
()
const
throw
()
{
{
return
msg
.
c_str
();
return
msg
.
c_str
();
}
}
private:
private:
std
::
string
msg
;
std
::
string
msg
;
};
};
}
// namespace pinkIndexer
#endif
/* CUSTOMEXCEPTION_H_ */
#endif
/* CUSTOMEXCEPTION_H_ */
include/ExperimentSettings.h
View file @
f1827cdd
...
@@ -11,8 +11,11 @@
...
@@ -11,8 +11,11 @@
#include
"Lattice.h"
#include
"Lattice.h"
#include
"WrongUsageException.h"
#include
"WrongUsageException.h"
class
ExperimentSettings
namespace
pinkIndexer
{
{
class
ExperimentSettings
{
public:
public:
ExperimentSettings
(
float
coffset_m
,
float
clen_mm
,
float
beamEenergy_eV
,
float
divergenceAngle_deg
,
float
nonMonochromaticity
,
float
pixelLength_m
,
ExperimentSettings
(
float
coffset_m
,
float
clen_mm
,
float
beamEenergy_eV
,
float
divergenceAngle_deg
,
float
nonMonochromaticity
,
float
pixelLength_m
,
float
detectorRadius_pixel
,
float
minRealLatticeVectorLength_A
,
float
maxRealLatticeVectorLength_A
,
float
reflectionRadius_1_per_A
);
float
detectorRadius_pixel
,
float
minRealLatticeVectorLength_A
,
float
maxRealLatticeVectorLength_A
,
float
reflectionRadius_1_per_A
);
...
@@ -107,6 +110,6 @@ class ExperimentSettings
...
@@ -107,6 +110,6 @@ class ExperimentSettings
public:
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
};
}
// namespace pinkIndexer
#endif
/* EXPERIMENTSETTINGS_H_ */
#endif
/* EXPERIMENTSETTINGS_H_ */
include/Lattice.h
View file @
f1827cdd
...
@@ -11,8 +11,11 @@
...
@@ -11,8 +11,11 @@
#include
<Eigen/Dense>
#include
<Eigen/Dense>
#include
<iostream>
#include
<iostream>
class
Lattice
namespace
pinkIndexer
{
{
class
Lattice
{
public:
public:
Lattice
();
Lattice
();
Lattice
(
const
Eigen
::
Matrix3f
&
basis
);
Lattice
(
const
Eigen
::
Matrix3f
&
basis
);
...
@@ -54,6 +57,6 @@ class Lattice
...
@@ -54,6 +57,6 @@ class Lattice
public:
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
};
}
// namespace pinkIndexer
#endif
/* LATTICE_H_ */
#endif
/* LATTICE_H_ */
include/PinkIndexer.h
View file @
f1827cdd
...
@@ -11,9 +11,11 @@
...
@@ -11,9 +11,11 @@
#include
<Eigen/Dense>
#include
<Eigen/Dense>
#include
<stdint.h>
#include
<stdint.h>
namespace
pinkIndexer
class
PinkIndexer
{
{
class
PinkIndexer
{
public:
public:
enum
class
ConsideredPeaksCount
enum
class
ConsideredPeaksCount
{
{
...
@@ -47,10 +49,10 @@ class PinkIndexer
...
@@ -47,10 +49,10 @@ class PinkIndexer
PinkIndexer
(
const
ExperimentSettings
&
experimentSettings
,
ConsideredPeaksCount
consideredPeaksCount
,
AngleResolution
angleResolution
,
PinkIndexer
(
const
ExperimentSettings
&
experimentSettings
,
ConsideredPeaksCount
consideredPeaksCount
,
AngleResolution
angleResolution
,
RefinementType
refinementType
,
float
maxResolutionForIndexing_1_per_A
);
RefinementType
refinementType
,
float
maxResolutionForIndexing_1_per_A
);
int
indexPattern
(
Lattice
&
indexedLattice
,
Eigen
::
Vector2f
&
centerShift
,
Eigen
::
Array
<
bool
,
Eigen
::
Dynamic
,
1
>&
fittedPeaks
,
Eigen
::
RowVectorXf
&
intensities
,
int
indexPattern
(
Lattice
&
indexedLattice
,
Eigen
::
Vector2f
&
centerShift
,
Eigen
::
Array
<
bool
,
Eigen
::
Dynamic
,
1
>&
fittedPeaks
,
const
Eigen
::
Matrix2Xf
&
detectorPeaks_m
,
int
threadCount
);
Eigen
::
RowVectorXf
&
intensities
,
const
Eigen
::
Matrix2Xf
&
detectorPeaks_m
,
int
threadCount
);
int
indexPattern
(
Lattice
&
indexedLattice
,
Eigen
::
Vector2f
&
centerShift
,
Eigen
::
Array
<
bool
,
Eigen
::
Dynamic
,
1
>&
fittedPeaks
,
Eigen
::
RowVectorXf
&
intensities
,
int
indexPattern
(
Lattice
&
indexedLattice
,
Eigen
::
Vector2f
&
centerShift
,
Eigen
::
Array
<
bool
,
Eigen
::
Dynamic
,
1
>&
fittedPeaks
,
const
Eigen
::
Matrix3Xf
&
meanReciprocalPeaks_1_per_A
,
int
threadCount
);
Eigen
::
RowVectorXf
&
intensities
,
const
Eigen
::
Matrix3Xf
&
meanReciprocalPeaks_1_per_A
,
int
threadCount
);
private:
private:
void
reducePeakCount
(
Eigen
::
Matrix3Xf
&
ucsDirections
,
Eigen
::
Array2Xf
&
ucsBorderNorms
,
Eigen
::
RowVectorXf
&
intensities
,
void
reducePeakCount
(
Eigen
::
Matrix3Xf
&
ucsDirections
,
Eigen
::
Array2Xf
&
ucsBorderNorms
,
Eigen
::
RowVectorXf
&
intensities
,
...
@@ -72,4 +74,5 @@ class PinkIndexer
...
@@ -72,4 +74,5 @@ class PinkIndexer
RefinementType
refinementType
;
RefinementType
refinementType
;
float
maxResolutionForIndexing_1_per_A
;
float
maxResolutionForIndexing_1_per_A
;
float
finalRefinementTolerance
;
float
finalRefinementTolerance
;
};
};
\ No newline at end of file
}
// namespace pinkIndexer
\ No newline at end of file
include/ReciprocalToRealProjection.h
View file @
f1827cdd
...
@@ -3,9 +3,10 @@
...
@@ -3,9 +3,10 @@
#include
"ExperimentSettings.h"
#include
"ExperimentSettings.h"
#include
<Eigen/Dense>
#include
<Eigen/Dense>
namespace
pinkIndexer
class
ReciprocalToRealProjection
{
{
class
ReciprocalToRealProjection
{
public:
public:
ReciprocalToRealProjection
(
const
ExperimentSettings
&
experimentSettings
);
ReciprocalToRealProjection
(
const
ExperimentSettings
&
experimentSettings
);
virtual
~
ReciprocalToRealProjection
()
=
default
;
virtual
~
ReciprocalToRealProjection
()
=
default
;
...
@@ -14,4 +15,5 @@ class ReciprocalToRealProjection
...
@@ -14,4 +15,5 @@ class ReciprocalToRealProjection
protected:
protected:
ExperimentSettings
experimentSettings
;
ExperimentSettings
experimentSettings
;
};
};
}
// namespace pinkIndexer
\ No newline at end of file
include/Refinement.h
View file @
f1827cdd
...
@@ -7,8 +7,10 @@
...
@@ -7,8 +7,10 @@
#include
<Eigen/Dense>
#include
<Eigen/Dense>
#include
<vector>
#include
<vector>
class
Refinement
namespace
pinkIndexer
{
{
class
Refinement
{
public:
public:
Refinement
(
float
tolerance
);
Refinement
(
float
tolerance
);
Refinement
(
float
tolerance
,
const
Backprojection
&
backprojection
);
Refinement
(
float
tolerance
,
const
Backprojection
&
backprojection
);
...
@@ -63,4 +65,5 @@ class Refinement
...
@@ -63,4 +65,5 @@ class Refinement
Eigen
::
Matrix2Xf
detectorPeaks_m_shifted
;
Eigen
::
Matrix2Xf
detectorPeaks_m_shifted
;
Eigen
::
Matrix3Xf
ucsDirections
;
Eigen
::
Matrix3Xf
ucsDirections
;
Eigen
::
Array2Xf
ucsBorderNorms
;
Eigen
::
Array2Xf
ucsBorderNorms
;
};
};
}
// namespace pinkIndexer
\ No newline at end of file
include/ReflectionsInRangeFinder.h
View file @
f1827cdd
#pragma once
#pragma once
#include
"BadInputException.h"
#include
"ExperimentSettings.h"
#include
"ExperimentSettings.h"
#include
"eigenSTLContainers.h"
#include
"eigenSTLContainers.h"
#include
"BadInputException.h"
class
ReflectionsInRangeFind
er
namespace
pinkIndex
er
{
{
class
ReflectionsInRangeFinder
{
public:
public:
ReflectionsInRangeFinder
(
const
Lattice
&
lattice
);
ReflectionsInRangeFinder
(
const
Lattice
&
lattice
);
...
@@ -15,4 +17,5 @@ class ReflectionsInRangeFinder
...
@@ -15,4 +17,5 @@ class ReflectionsInRangeFinder
Eigen
::
Matrix3Xf
reflectionsDirections_sorted
;
Eigen
::
Matrix3Xf
reflectionsDirections_sorted
;
std
::
vector
<
float
>
norms_sorted
;
std
::
vector
<
float
>
norms_sorted
;
float
maxRadius
;
float
maxRadius
;
};
};
\ No newline at end of file
}
// namespace pinkIndexer
\ No newline at end of file
include/SimpleDiffractionPatternPrediction.h
View file @
f1827cdd
...
@@ -4,8 +4,10 @@
...
@@ -4,8 +4,10 @@
#include
"SimpleProjection.h"
#include
"SimpleProjection.h"
#include
<Eigen/Dense>
#include
<Eigen/Dense>
class
SimpleDiffractionPatternPrediction
namespace
pinkIndexer
{
{
class
SimpleDiffractionPatternPrediction
{
public:
public:
SimpleDiffractionPatternPrediction
(
const
ExperimentSettings
&
experimentSettings
);
SimpleDiffractionPatternPrediction
(
const
ExperimentSettings
&
experimentSettings
);
...
@@ -20,4 +22,5 @@ class SimpleDiffractionPatternPrediction
...
@@ -20,4 +22,5 @@ class SimpleDiffractionPatternPrediction
float
reciprocalLambdaShort
,
reciprocalLambdaLong
;
float
reciprocalLambdaShort
,
reciprocalLambdaLong
;
float
reciprocalLambdaShort_extended_squared
,
reciprocalLambdaLong_extended_squared
;
float
reciprocalLambdaShort_extended_squared
,
reciprocalLambdaLong_extended_squared
;
float
detectorDistance
;
float
detectorDistance
;
};
};
}
// namespace pinkIndexer
\ No newline at end of file
include/SimpleProjection.h
View file @
f1827cdd
...
@@ -3,10 +3,13 @@
...
@@ -3,10 +3,13 @@
#include
"ReciprocalToRealProjection.h"
#include
"ReciprocalToRealProjection.h"
#include
<Eigen/Dense>
#include
<Eigen/Dense>
class
SimpleProjection
:
public
ReciprocalToRealProjection
namespace
pinkIndexer
{
{
class
SimpleProjection
:
public
ReciprocalToRealProjection
{
public:
public:
SimpleProjection
(
const
ExperimentSettings
&
experimentSettings
);
SimpleProjection
(
const
ExperimentSettings
&
experimentSettings
);
void
project
(
Eigen
::
Matrix2Xf
&
projectedPeaks
,
const
Eigen
::
Matrix3Xf
&
reciprocalPeaks
)
const
;
void
project
(
Eigen
::
Matrix2Xf
&
projectedPeaks
,
const
Eigen
::
Matrix3Xf
&
reciprocalPeaks
)
const
;
};
};
}
// namespace pinkIndexer
\ No newline at end of file
include/Sinogram.h
View file @
f1827cdd
...
@@ -9,8 +9,10 @@
...
@@ -9,8 +9,10 @@
#include
<string>
#include
<string>
#include
<vector>
#include
<vector>
class
Sinogram
namespace
pinkIndexer
{
{
class
Sinogram
{
public:
public:
Sinogram
(
const
Lattice
&
lattice
);
Sinogram
(
const
Lattice
&
lattice
);
...
@@ -42,4 +44,5 @@ class Sinogram
...
@@ -42,4 +44,5 @@ class Sinogram
public:
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
};
\ No newline at end of file
}
// namespace pinkIndexer
\ No newline at end of file
include/WrongUsageException.h
View file @
f1827cdd
...
@@ -10,20 +10,18 @@
...
@@ -10,20 +10,18 @@
#include
<CustomException.h>
#include
<CustomException.h>
//! A specialization of MyException.
namespace
pinkIndexer
/*!
{
* This exception is thrown whenever a function/method is used in a wrong way
*/
class
WrongUsageException
:
public
CustomException
{
public:
WrongUsageException
(
const
std
::
string
&
msg
)
:
CustomException
(
msg
)
{
}
virtual
~
WrongUsageException
()
throw
()
class
WrongUsageException
:
public
CustomException
{
public:
WrongUsageException
(
const
std
::
string
&
msg
)
:
CustomException
(
msg
)
{
{
}
}
};
virtual
~
WrongUsageException
()
throw
()
{}
};
}
// namespace pinkIndexer
#endif
/* WRONGUSAGEEXCEPTION_H_ */
#endif
/* WRONGUSAGEEXCEPTION_H_ */
include/adaptions/crystfel/ExperimentSettings.h
View file @
f1827cdd
...
@@ -4,22 +4,25 @@
...
@@ -4,22 +4,25 @@
#include
"Lattice.h"
#include
"Lattice.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
namespace
pinkIndexer
{
extern
"C"
{
#endif
#endif
typedef
struct
ExperimentSettings
ExperimentSettings
;
typedef
struct
ExperimentSettings
ExperimentSettings
;
ExperimentSettings
*
ExperimentSettings_new_nolatt
(
float
beamEenergy_eV
,
float
detectorDistance_m
,
float
detectorRadius_m
,
float
divergenceAngle_deg
,
ExperimentSettings
*
ExperimentSettings_new_nolatt
(
float
beamEenergy_eV
,
float
detectorDistance_m
,
float
detectorRadius_m
,
float
divergenceAngle_deg
,
float
nonMonochromaticity
,
float
minRealLatticeVectorLength_A
,
float
maxRealLatticeVectorLength_A
,
float
nonMonochromaticity
,
float
minRealLatticeVectorLength_A
,
float
maxRealLatticeVectorLength_A
,
float
reflectionRadius_1_per_A
);
float
reflectionRadius_1_per_A
);
ExperimentSettings
*
ExperimentSettings_new
(
float
beamEenergy_eV
,
float
detectorDistance_m
,
float
detectorRadius_m
,
float
divergenceAngle_deg
,
ExperimentSettings
*
ExperimentSettings_new
(
float
beamEenergy_eV
,
float
detectorDistance_m
,
float
detectorRadius_m
,
float
divergenceAngle_deg
,
float
nonMonochromaticity
,
const
Lattice_t
sampleReciprocalLattice_1A
,
float
tolerance
,
float
nonMonochromaticity
,
const
Lattice_t
sampleReciprocalLattice_1A
,
float
tolerance
,
float
reflectionRadius_1_per_A
);
float
reflectionRadius_1_per_A
);
void
ExperimentSettings_delete
(
ExperimentSettings
*
experimentSettings
);
void
ExperimentSettings_delete
(
ExperimentSettings
*
experimentSettings
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
}
#endif
#endif
...
...
include/adaptions/crystfel/Lattice.h
View file @
f1827cdd
...
@@ -30,14 +30,17 @@ typedef struct
...
@@ -30,14 +30,17 @@ typedef struct
}
LatticeTransform_t
;
}
LatticeTransform_t
;
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
namespace
pinkIndexer
{
extern
"C"
{
#endif
#endif
void
reorderLattice
(
const
Lattice_t
*
prototype
,
Lattice_t
*
lattice
);
void
reorderLattice
(
const
Lattice_t
*
prototype
,
Lattice_t
*
lattice
);
void
reduceLattice
(
Lattice_t
*
lattice
,
LatticeTransform_t
*
appliedReductionTransform
);
void
reduceLattice
(
Lattice_t
*
lattice
,
LatticeTransform_t
*
appliedReductionTransform
);
void
restoreLattice
(
Lattice_t
*
lattice
,
LatticeTransform_t
*
appliedReductionTransform
);
void
restoreLattice
(
Lattice_t
*
lattice
,
LatticeTransform_t
*
appliedReductionTransform
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
}
#endif
#endif
...
...
include/adaptions/crystfel/PinkIndexer.h
View file @
f1827cdd
...
@@ -6,11 +6,13 @@
...
@@ -6,11 +6,13 @@
#include
"indexerData.h"
#include
"indexerData.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
namespace
pinkIndexer
{
extern
"C"
{
#endif
#endif
typedef
enum
typedef
enum
{
{
CONSIDERED_PEAKS_COUNT_veryFew
=
0
,
CONSIDERED_PEAKS_COUNT_veryFew
=
0
,
CONSIDERED_PEAKS_COUNT_few
=
1
,
CONSIDERED_PEAKS_COUNT_few
=
1
,
CONSIDERED_PEAKS_COUNT_standard
=
2
,
CONSIDERED_PEAKS_COUNT_standard
=
2
,
...
@@ -18,10 +20,10 @@ typedef enum
...
@@ -18,10 +20,10 @@ typedef enum
CONSIDERED_PEAKS_COUNT_manyMany
=
4
,
CONSIDERED_PEAKS_COUNT_manyMany
=
4
,
CONSIDERED_PEAKS_COUNT_lastEnum
CONSIDERED_PEAKS_COUNT_lastEnum
}
consideredPeaksCount_t
;
}
consideredPeaksCount_t
;
typedef
enum
typedef
enum
{
{
ANGLE_RESOLUTION_extremelyLoose
=
0
,
ANGLE_RESOLUTION_extremelyLoose
=
0
,
ANGLE_RESOLUTION_loose
=
1
,
ANGLE_RESOLUTION_loose
=
1
,
ANGLE_RESOLUTION_standard
=
2
,
ANGLE_RESOLUTION_standard
=
2
,
...
@@ -29,10 +31,10 @@ typedef enum
...
@@ -29,10 +31,10 @@ typedef enum
ANGLE_RESOLUTION_extremelyDense
=
4
,
ANGLE_RESOLUTION_extremelyDense
=
4
,
ANGLE_RESOLUTION_lastEnum
ANGLE_RESOLUTION_lastEnum
}
angleResolution_t
;
}
angleResolution_t
;