Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
5b8cc2ee
Commit
5b8cc2ee
authored
3 years ago
by
m.puchner
Browse files
Options
Downloads
Plain Diff
Merge branch 'issue_67' into 'develop'
allow arbitrary ordering of Q Closes
#67
See merge request
!97
parents
92aa5123
cdbc3427
No related branches found
No related tags found
1 merge request
!97
allow arbitrary ordering of Q
Pipeline
#38239
passed
3 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/DataLoaders/QREDataLoader.cpp
+25
-11
25 additions, 11 deletions
GUI/DataLoaders/QREDataLoader.cpp
GUI/DataLoaders/QREDataLoader.h
+1
-1
1 addition, 1 deletion
GUI/DataLoaders/QREDataLoader.h
with
26 additions
and
12 deletions
GUI/DataLoaders/QREDataLoader.cpp
+
25
−
11
View file @
5b8cc2ee
...
...
@@ -208,6 +208,17 @@ void QREDataLoader::deserialize(const QByteArray& data)
if
(
s
.
status
()
!=
QDataStream
::
Ok
)
throw
DeserializationException
::
streamError
();
// If calculationErrors contains the outdated "WrongQOrder": Throw "too old".
// Recalculation seems to be an option, but is difficult to realize since the item's
// data loading takes place at another spot in the loading process (to keep compatibility).
// Taking the little likelihood of such a file in an old project into account, it seems to
// be not worth the effort to implement compatibility for such a project.
// #baProjectCompatibility If it is decided to break project compatibility, these lines can be
// removed, as well as the type WrongQOrder itself.
for
(
const
auto
&
error
:
m_importResult
.
calculationErrors
.
values
())
if
(
error
.
type
==
ErrorDefinition
::
wrongQOrder
)
throw
DeserializationException
::
tooOld
();
}
AbstractDataLoader
*
QREDataLoader
::
clone
()
const
...
...
@@ -461,7 +472,6 @@ void QREDataLoader::calculateFromParseResult() const
const
int
eCol
=
c
[
DataType
::
dR
].
column
;
QSet
<
double
>
foundQValues
;
double
lastFoundQ
=
std
::
numeric_limits
<
double
>::
quiet_NaN
();
for
(
int
lineNr
=
0
;
lineNr
<
m_importResult
.
lines
.
size
();
lineNr
++
)
{
const
bool
skipLine
=
m_importResult
.
lines
[
lineNr
].
first
;
...
...
@@ -504,11 +514,6 @@ void QREDataLoader::calculateFromParseResult() const
continue
;
}
if
(
!
std
::
isnan
(
lastFoundQ
)
&&
q
<=
lastFoundQ
)
{
m_importResult
.
addError
(
lineNr
,
ErrorDefinition
::
wrongQOrder
);
continue
;
}
if
(
r
>
1.0
)
{
m_importResult
.
addError
(
lineNr
,
ErrorDefinition
::
RGreaterOne
,
r
);
continue
;
...
...
@@ -524,22 +529,31 @@ void QREDataLoader::calculateFromParseResult() const
m_importResult
.
eValues
[
lineNr
]
=
e
;
m_importResult
.
validCalculatedLines
++
;
foundQValues
<<
q
;
lastFoundQ
=
q
;
}
}
void
QREDataLoader
::
createOutputDataFromParsingResult
(
RealDataItem
*
item
)
const
{
// -- create OutputData
std
::
vector
<
double
>
qVec
;
std
::
vector
<
double
>
rVec
;
// create data sorted by ascending Q values.
// For this, the line numbers are sorted by Q
QVector
<
int
>
lineNumbers
;
for
(
int
lineNr
=
0
;
lineNr
<
m_importResult
.
lines
.
size
();
lineNr
++
)
{
const
bool
skipLine
=
m_importResult
.
lines
[
lineNr
].
first
;
const
bool
lineHasError
=
m_importResult
.
calculationErrors
.
contains
(
lineNr
);
if
(
skipLine
||
lineHasError
)
continue
;
lineNumbers
.
push_back
(
lineNr
);
}
std
::
sort
(
lineNumbers
.
begin
(),
lineNumbers
.
end
(),
[
&
](
int
a
,
int
b
)
{
return
m_importResult
.
qValues
[
a
]
<
m_importResult
.
qValues
[
b
];
});
// -- create OutputData
std
::
vector
<
double
>
qVec
;
std
::
vector
<
double
>
rVec
;
for
(
auto
lineNr
:
lineNumbers
)
{
qVec
.
push_back
(
m_importResult
.
qValues
[
lineNr
]);
rVec
.
push_back
(
m_importResult
.
rValues
[
lineNr
]);
}
...
...
This diff is collapsed.
Click to expand it.
GUI/DataLoaders/QREDataLoader.h
+
1
−
1
View file @
5b8cc2ee
...
...
@@ -85,7 +85,7 @@ private:
none
=
0
,
columnDoesNotContainValidNumber
=
1
,
duplicateQ
=
2
,
wrongQOrder
=
3
,
wrongQOrder
=
3
,
// outdated, but kept for backwards compatibility (deserialize!)
RGreaterOne
=
4
,
RLessZero
=
5
};
...
...
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