Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SAMMY
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RNSD
SAMMY
Commits
f5d38ffd
Commit
f5d38ffd
authored
4 years ago
by
Wiarda, Dorothea
Browse files
Options
Downloads
Patches
Plain Diff
Address review comments.
parent
55b5f8fd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
sammy/src/salmon/GridData.h
+28
-7
28 additions, 7 deletions
sammy/src/salmon/GridData.h
sammy/src/salmon/SammyGridAccess.h
+57
-0
57 additions, 0 deletions
sammy/src/salmon/SammyGridAccess.h
sammy/src/salmon/tests/GridDataTest.cpp
+2
-4
2 additions, 4 deletions
sammy/src/salmon/tests/GridDataTest.cpp
with
87 additions
and
11 deletions
sammy/src/salmon/GridData.h
+
28
−
7
View file @
f5d38ffd
...
...
@@ -10,12 +10,21 @@ namespace sammy{
/**
* @brief The GridData class contains energy data and potentially data points
*
* The grid can be energy or angle (energy in pos 0 and angle in pos 1) or anything that
* The row offset is stored for use by calling programs (for example to indicate that
* we want position i in energy the first energy. But because there can be more than
* one equal energy in position 0, the use of this parameter is left to the calling program
* Ideally, there is going to be one grid with experiental data points for each data set to be
* fitted. There may be corresponding auxiallary grid for each data set with additional points
* needed for calculation (for exampe extra energy points for doppler broadening)
*
* The start of the data is indicated by the function getDataIndex
* Since SAMMY uses one grid and one auxillary grid only, we allowed to have
* more than one column to allow to experimental data (for example energy in column 0, angle in column 1)
* In this case energy points for each angle are repeated (as SAMMY requires all angle data to be on the
* same energy grid). But we want to relax that going forward.
*
* To indicate where the data start, the grid has a function (getDataIndex) to indicate the data column
*
* Sometimes we may want to store more energy data then are used for the calculation, for example extra data points being read
* in or points of the auxillary grid not used, therefore we allow for an offset, that indicates from where counting of
* data points start (getRowOffset/setRowOffset()). This does not affect the indexing used by getData to retrieve data from the
* grid.
*
*/
class
GridData
{
...
...
@@ -140,7 +149,13 @@ namespace sammy{
/**
* Get the index of the auxillary grid, if using.
* By default this is the second grid if present and the first grid otherwise
* By default this is the second grid if present and the first grid otherwise.
*
* Note: In principle this should be in the GridAccess class. However,
* only the GridDataList is currently globally available in SAMMY.
* Thus, until a correct object of GridAccess can be passed arround,
* we opted to have the information in this class.
*
* @brief getAuxGridIndex index of the auxillary grid, if using.
* @return index of the auxillary grid, if using.
*/
...
...
@@ -148,7 +163,13 @@ namespace sammy{
/**
* Get the index of the experimental grid, if using.
* By default this is the first grid
* By default this is the first grid.
*
* Note: In principle this should be in the GridAccess class. However,
* only the GridDataList is currently globally available in SAMMY.
* Thus, until a correct object of GridAccess can be passed arround,
* we opted to have the information in this class.
*
* @brief getExpGridIndex index of the experimental grid, if using.
* @return index of the experimental grid, if using.
*/
...
...
This diff is collapsed.
Click to expand it.
sammy/src/salmon/SammyGridAccess.h
+
57
−
0
View file @
f5d38ffd
...
...
@@ -4,22 +4,79 @@
#include
"GridData.h"
namespace
sammy
{
/**
* @brief The SammyGridAccess class enables easier use of the new GridData in SAMMY
*
* Going forward, we would like to store experimental, theoretical and derivative data in
* the new GridData. This class attempts to make the transition within SAMMY easier.
*
* Currently, SAMMY has two grids: experimental grid and auxiallary grid. If angle data
* are given, the angle grid (of length numcro) needs to be the same for each energy at
* which angles are given. In addition energies sometimes are used with an additional calibration
* applied (ktzero != 0).
*
* In order to allow for the least amount of changes in SAMMY, this class gives functions to access the
* energy just as SAMMY would access its current energy grid, with the function getEnergy. If a
* If the underlying GridData has a row offset applied it is taken into acount in the index passed to getEnergy.
* Depending on the value of ktzero, the orignal or the calibrated energy is returned (getOrigEnergy) will always
* give the user energy.
*
* The grid access can be either to the experimental grid or the auxillary grid.
*/
class
SammyGridAccess
{
public:
SammyGridAccess
()
:
numcro
(
1
),
ktzero
(
0
),
gridIndex
(
0
){}
virtual
~
SammyGridAccess
(){}
/**
* Set the values for numcro and ktzero.
* See class description for more info.
*
* @param numcro number of angles on the angle grid for each energy
* @param ktzero do we have an energy calibration applied
*/
void
setParameters
(
int
numcro
,
int
ktzero
);
/**
* Indicate that this access is for the experimental grid
* @param list the container for the underlying grids
*/
void
setExpGrid
(
const
GridDataList
&
list
);
/**
* Indicate that this access is for the auxillary grid
* @param list the container for the underlying grids
*/
void
setAuxGrid
(
const
GridDataList
&
list
);
/**
* Get the energy at the desired index.
* If a row offset is set on the underlying grid, the index is corrected for the offset before
* retrieving the data
* @param index the index for the desired energy
* @param list the underlying list info
* @return the energy at the indicated index
*/
double
getEnergy
(
int
index
,
const
GridDataList
&
list
)
const
;
/**
* Get the original energy at the desired index. Unless ktzero != 0, this is the same as getEnergy.
*
* If a row offset is set on the underlying grid, the index is corrected for the offset before
* retrieving the data
* @param index the index for the desired energy
* @param list the underlying list info
* @return the energy at the indicated index
*/
double
getOrigEnergy
(
int
index
,
const
GridDataList
&
list
)
const
;
/**
* Get the number of energy points on the desired grid.
* If a row offset is set on the underlying grid, the number is adjusted accordingly.
* @param list the underlying list info
* @return number of energy points on the desired grid.
*/
int
getNumEnergies
(
const
GridDataList
&
list
)
const
;
private
:
...
...
This diff is collapsed.
Click to expand it.
sammy/src/salmon/tests/GridDataTest.cpp
+
2
−
4
View file @
f5d38ffd
...
...
@@ -78,8 +78,8 @@ TEST(DataInfo,gridData){
// copy constructor
sammy
::
GridData
gridCopy
(
grid
);
gridCopy
.
s
etDataIndex
(
6
);
gridCopy
.
s
etRowOffset
(
9
);
ASSERT_EQ
(
6
,
gridCopy
.
g
etDataIndex
(
)
);
ASSERT_EQ
(
9
,
gridCopy
.
g
etRowOffset
(
)
);
xx
=
1.0
;
for
(
int
i
=
0
;
i
<
5
;
i
++
){
for
(
int
j
=
0
;
j
<
3
;
j
++
){
...
...
@@ -118,7 +118,6 @@ TEST(GridList, gridDataList){
for
(
int
j
=
0
;
j
<
2
;
j
++
){
ASSERT_NEAR
(
i
+
1
,
grid
->
getData
(
j
,
1
),
1e-3
);
\
ASSERT_NEAR
(
i
+
5
,
list
.
getExperimentalCov
(
i
*
3
,
j
),
1e-3
);
}
}
...
...
@@ -134,7 +133,6 @@ TEST(GridList, gridDataList){
for
(
int
j
=
0
;
j
<
2
;
j
++
){
ASSERT_NEAR
(
i
+
1
,
grid
->
getData
(
j
,
1
),
1e-3
);
\
ASSERT_NEAR
(
i
+
5
,
listCopy
.
getExperimentalCov
(
i
*
3
,
j
),
1e-3
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment