Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tlibs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Scientific Software
Takin
tlibs
Commits
6a185507
Commit
6a185507
authored
Jan 21, 2020
by
Tobias WEBER
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added linear polarisation analysis to scanviewer
parent
327ecd8a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
6 deletions
+98
-6
file/loadinstr.h
file/loadinstr.h
+13
-1
file/loadinstr_impl.h
file/loadinstr_impl.h
+85
-5
No files found.
file/loadinstr.h
View file @
6a185507
...
@@ -85,7 +85,9 @@ class FileInstrBase
...
@@ -85,7 +85,9 @@ class FileInstrBase
virtual
std
::
size_t
NumPolChannels
()
const
;
virtual
std
::
size_t
NumPolChannels
()
const
;
virtual
const
std
::
vector
<
std
::
array
<
t_real
,
6
>>&
GetPolStates
()
const
;
virtual
const
std
::
vector
<
std
::
array
<
t_real
,
6
>>&
GetPolStates
()
const
;
virtual
void
SetPolNames
(
const
char
*
pVec1
,
const
char
*
pVec2
,
virtual
void
SetPolNames
(
const
char
*
pVec1
,
const
char
*
pVec2
,
const
char
*
pCur1
,
const
char
*
pCur2
);
const
char
*
pCur1
,
const
char
*
pCur2
);
// spherical PA
virtual
void
SetLinPolNames
(
const
char
*
pFlip1
,
const
char
*
pFlip2
,
const
char
*
pXYZ
);
// linear PA
public:
public:
virtual
bool
MatchColumn
(
const
std
::
string
&
strRegex
,
virtual
bool
MatchColumn
(
const
std
::
string
&
strRegex
,
...
@@ -125,6 +127,9 @@ class FilePsi : public FileInstrBase<_t_real>
...
@@ -125,6 +127,9 @@ class FilePsi : public FileInstrBase<_t_real>
std
::
string
m_strPolVec1
{
"p1"
},
m_strPolVec2
{
"p2"
};
std
::
string
m_strPolVec1
{
"p1"
},
m_strPolVec2
{
"p2"
};
std
::
string
m_strPolCur1
{
"i1"
},
m_strPolCur2
{
"i2"
};
std
::
string
m_strPolCur1
{
"i1"
},
m_strPolCur2
{
"i2"
};
std
::
string
m_strXYZ
{
"hx"
};
std
::
string
m_strFlip1
{
"f1"
},
m_strFlip2
{
"f2"
};
protected:
protected:
void
ReadData
(
std
::
istream
&
istr
);
void
ReadData
(
std
::
istream
&
istr
);
...
@@ -201,6 +206,13 @@ class FilePsi : public FileInstrBase<_t_real>
...
@@ -201,6 +206,13 @@ class FilePsi : public FileInstrBase<_t_real>
m_strPolVec1
=
pVec1
;
m_strPolVec2
=
pVec2
;
m_strPolVec1
=
pVec1
;
m_strPolVec2
=
pVec2
;
m_strPolCur1
=
pCur1
;
m_strPolCur2
=
pCur2
;
m_strPolCur1
=
pCur1
;
m_strPolCur2
=
pCur2
;
}
}
virtual
void
SetLinPolNames
(
const
char
*
pFlip1
,
const
char
*
pFlip2
,
const
char
*
pXYZ
)
override
{
m_strFlip1
=
pFlip1
;
m_strFlip2
=
pFlip2
;
m_strXYZ
=
pXYZ
;
}
};
};
...
...
file/loadinstr_impl.h
View file @
6a185507
...
@@ -298,6 +298,11 @@ void FileInstrBase<t_real>::SetPolNames(const char* pVec1, const char* pVec2,
...
@@ -298,6 +298,11 @@ void FileInstrBase<t_real>::SetPolNames(const char* pVec1, const char* pVec2,
const
char
*
pCur1
,
const
char
*
pCur2
)
const
char
*
pCur1
,
const
char
*
pCur2
)
{}
{}
template
<
class
t_real
>
void
FileInstrBase
<
t_real
>::
SetLinPolNames
(
const
char
*
pFlip1
,
const
char
*
pFlip2
,
const
char
*
pXYZ
)
{}
template
<
class
t_real
>
template
<
class
t_real
>
std
::
size_t
FileInstrBase
<
t_real
>::
NumPolChannels
()
const
std
::
size_t
FileInstrBase
<
t_real
>::
NumPolChannels
()
const
{
return
0
;
}
{
return
0
;
}
...
@@ -418,6 +423,8 @@ void FilePsi<t_real>::ParsePolData()
...
@@ -418,6 +423,8 @@ void FilePsi<t_real>::ParsePolData()
return
true
;
return
true
;
};
};
bool
bIsSphericalPA
=
1
;
bool
bSwitchOn
=
0
;
// iterate command lines
// iterate command lines
for
(
std
::
string
&
strLine
:
vecLines
)
for
(
std
::
string
&
strLine
:
vecLines
)
...
@@ -431,11 +438,14 @@ void FilePsi<t_real>::ParsePolData()
...
@@ -431,11 +438,14 @@ void FilePsi<t_real>::ParsePolData()
if
(
vecLine
.
size
()
==
0
)
if
(
vecLine
.
size
()
==
0
)
continue
;
continue
;
if
(
vecLine
[
0
]
==
"dr"
)
// polarisation vector or current driven
// first token: dr command
// polarisation vector or current driven
if
(
vecLine
[
0
]
==
"dr"
)
{
{
std
::
string
strCurDev
=
""
;
std
::
string
strCurDev
=
""
;
std
::
size_t
iCurComp
=
0
;
std
::
size_t
iCurComp
=
0
;
// scan next tokens in drive command
for
(
std
::
size_t
iDr
=
1
;
iDr
<
vecLine
.
size
();
++
iDr
)
for
(
std
::
size_t
iDr
=
1
;
iDr
<
vecLine
.
size
();
++
iDr
)
{
{
const
std
::
string
&
strWord
=
vecLine
[
iDr
];
const
std
::
string
&
strWord
=
vecLine
[
iDr
];
...
@@ -444,8 +454,12 @@ void FilePsi<t_real>::ParsePolData()
...
@@ -444,8 +454,12 @@ void FilePsi<t_real>::ParsePolData()
{
{
t_real
dNum
=
tl
::
str_to_var
<
t_real
>
(
strWord
);
t_real
dNum
=
tl
::
str_to_var
<
t_real
>
(
strWord
);
// --------------------------------------------------
// for spherical polarisation analysis
// --------------------------------------------------
if
(
strCurDev
==
m_strPolVec1
)
if
(
strCurDev
==
m_strPolVec1
)
{
// incoming polarisation vector changed
{
// incoming polarisation vector changed
switch
(
iCurComp
)
switch
(
iCurComp
)
{
{
case
0
:
Pix
=
dNum
;
break
;
case
0
:
Pix
=
dNum
;
break
;
...
@@ -482,18 +496,84 @@ void FilePsi<t_real>::ParsePolData()
...
@@ -482,18 +496,84 @@ void FilePsi<t_real>::ParsePolData()
Pf_sign
=
t_real
(
-
1
);
Pf_sign
=
t_real
(
-
1
);
}
}
}
}
// --------------------------------------------------
// --------------------------------------------------
// for linear polarisation analysis
// --------------------------------------------------
else
if
(
strCurDev
==
m_strXYZ
)
{
bIsSphericalPA
=
0
;
// sample guide field vector changed
switch
(
iCurComp
)
{
case
0
:
Pfx
=
Pix
=
dNum
;
break
;
case
1
:
Pfy
=
Piy
=
dNum
;
break
;
case
2
:
Pfz
=
Piz
=
dNum
;
break
;
}
}
// --------------------------------------------------
++
iCurComp
;
++
iCurComp
;
}
}
else
// (next) device to drive
else
// (next) device to drive
{
{
strCurDev
=
strWord
;
iCurComp
=
0
;
iCurComp
=
0
;
strCurDev
=
strWord
;
}
}
}
}
}
}
else
if
(
vecLine
[
0
]
==
"co"
)
// count command issued -> save current spin states
// --------------------------------------------------
// for linear polarisation analysis
// --------------------------------------------------
else
if
(
vecLine
.
size
()
>
1
&&
(
vecLine
[
0
]
==
"on"
||
vecLine
[
0
]
==
"off"
||
vecLine
[
0
]
==
"of"
))
{
{
if
(
vecLine
[
0
]
==
"on"
)
bSwitchOn
=
1
;
else
if
(
vecLine
[
0
]
==
"off"
||
vecLine
[
0
]
==
"of"
)
bSwitchOn
=
0
;
std
::
string
strFlip
=
vecLine
[
1
];
if
(
strFlip
==
m_strFlip1
)
{
bIsSphericalPA
=
0
;
Pi_sign
=
bSwitchOn
?
t_real
(
-
1
)
:
t_real
(
1
);
}
else
if
(
strFlip
==
m_strFlip2
)
{
bIsSphericalPA
=
0
;
Pf_sign
=
bSwitchOn
?
t_real
(
-
1
)
:
t_real
(
1
);
}
}
// --------------------------------------------------
// count command issued -> save current spin states
else
if
(
vecLine
[
0
]
==
"co"
)
{
// for linear PA, we only have principal directions
// and diagonal elements of the P matrix
// values in the other components are correction currents
if
(
!
bIsSphericalPA
)
{
int
maxComp
=
0
;
if
(
std
::
abs
(
Piy
)
>
std
::
abs
(
Pix
)
&&
std
::
abs
(
Piy
)
>
std
::
abs
(
Piz
))
maxComp
=
1
;
if
(
std
::
abs
(
Piz
)
>
std
::
abs
(
Piy
)
&&
std
::
abs
(
Piz
)
>
std
::
abs
(
Pix
))
maxComp
=
2
;
Pix
=
Piy
=
Piz
=
Pfx
=
Pfy
=
Pfz
=
0
;
if
(
maxComp
==
0
)
Pix
=
Pfx
=
1
;
else
if
(
maxComp
==
1
)
Piy
=
Pfy
=
1
;
else
if
(
maxComp
==
2
)
Piz
=
Pfz
=
1
;
}
m_vecPolStates
.
push_back
(
std
::
array
<
t_real
,
6
>
({{
m_vecPolStates
.
push_back
(
std
::
array
<
t_real
,
6
>
({{
Pi_sign
*
Pix
,
Pi_sign
*
Piy
,
Pi_sign
*
Piz
,
Pi_sign
*
Pix
,
Pi_sign
*
Piy
,
Pi_sign
*
Piz
,
Pf_sign
*
Pfx
,
Pf_sign
*
Pfy
,
Pf_sign
*
Pfz
}}));
Pf_sign
*
Pfx
,
Pf_sign
*
Pfy
,
Pf_sign
*
Pfz
}}));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment