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
298ffa5f
Commit
298ffa5f
authored
1 year ago
by
Mikhail Svechnikov
Browse files
Options
Downloads
Patches
Plain Diff
clang-format
parent
145304a4
No related branches found
No related tags found
1 merge request
!1678
Load GISAS data from REFSANS csv-table format (#580)
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Device/IO/ReadRefsans.cpp
+7
-6
7 additions, 6 deletions
Device/IO/ReadRefsans.cpp
GUI/View/Import/RealDataSelectorWidget.cpp
+3
-6
3 additions, 6 deletions
GUI/View/Import/RealDataSelectorWidget.cpp
with
10 additions
and
12 deletions
Device/IO/ReadRefsans.cpp
+
7
−
6
View file @
298ffa5f
...
@@ -36,14 +36,15 @@ bool getNextLine(std::istream& input_stream, std::string& line)
...
@@ -36,14 +36,15 @@ bool getNextLine(std::istream& input_stream, std::string& line)
}
}
return
false
;
return
false
;
}
}
}
}
// namespace
// From issue #580:
// From issue #580:
// 1. There is no header or metadata in any csv-file.
// 1. There is no header or metadata in any csv-file.
// 2. Each csv-matrix has 257 rows and 257 columns of comma-separated floating-point values with a period as the decimal separator.
// 2. Each csv-matrix has 257 rows and 257 columns of comma-separated floating-point values with a
// period as the decimal separator.
// 3. The first row and the first column are Q-values for each matrix element.
// 3. The first row and the first column are Q-values for each matrix element.
// 4. q-units are A^-1
// 4. q-units are A^-1
Datafield
*
Util
::
RW
::
readRefsans
(
std
::
istream
&
input_stream
)
Datafield
*
Util
::
RW
::
readRefsans
(
std
::
istream
&
input_stream
)
{
{
// read qx coords from first line
// read qx coords from first line
std
::
string
line
;
std
::
string
line
;
...
@@ -65,11 +66,11 @@ Datafield *Util::RW::readRefsans(std::istream &input_stream)
...
@@ -65,11 +66,11 @@ Datafield *Util::RW::readRefsans(std::istream &input_stream)
ASSERT
(
qz
.
front
()
!=
qz
.
back
());
ASSERT
(
qz
.
front
()
!=
qz
.
back
());
// sort axes
// sort axes
if
(
qz
.
front
()
>
qz
.
back
())
{
if
(
qz
.
front
()
>
qz
.
back
())
{
std
::
reverse
(
qz
.
begin
(),
qz
.
end
());
std
::
reverse
(
qz
.
begin
(),
qz
.
end
());
DataUtil
::
Data
::
invertAxis
(
1
,
matrix
);
DataUtil
::
Data
::
invertAxis
(
1
,
matrix
);
}
}
if
(
qy
.
front
()
>
qy
.
back
())
{
if
(
qy
.
front
()
>
qy
.
back
())
{
std
::
reverse
(
qy
.
begin
(),
qy
.
end
());
std
::
reverse
(
qy
.
begin
(),
qy
.
end
());
DataUtil
::
Data
::
invertAxis
(
0
,
matrix
);
DataUtil
::
Data
::
invertAxis
(
0
,
matrix
);
}
}
...
@@ -79,7 +80,7 @@ Datafield *Util::RW::readRefsans(std::istream &input_stream)
...
@@ -79,7 +80,7 @@ Datafield *Util::RW::readRefsans(std::istream &input_stream)
// flatten values
// flatten values
std
::
vector
<
double
>
values
;
std
::
vector
<
double
>
values
;
for
(
const
auto
&
row
:
matrix
)
for
(
const
auto
&
row
:
matrix
)
values
.
insert
(
values
.
end
(),
row
.
begin
(),
row
.
end
());
values
.
insert
(
values
.
end
(),
row
.
begin
(),
row
.
end
());
// create datafield
// create datafield
...
...
This diff is collapsed.
Click to expand it.
GUI/View/Import/RealDataSelectorWidget.cpp
+
3
−
6
View file @
298ffa5f
...
@@ -320,12 +320,9 @@ void RealDataSelectorWidget::importData1D()
...
@@ -320,12 +320,9 @@ void RealDataSelectorWidget::importData1D()
void
RealDataSelectorWidget
::
importData2D
()
void
RealDataSelectorWidget
::
importData2D
()
{
{
static
const
std
::
vector
<
std
::
pair
<
const
QString
,
IO
::
Filetype2D
>>
filters2D
{
static
const
std
::
vector
<
std
::
pair
<
const
QString
,
IO
::
Filetype2D
>>
filters2D
{
{
"TIFF (*.tif *.tiff *.tif.gz)"
,
IO
::
tiff
},
{
"TIFF (*.tif *.tiff *.tif.gz)"
,
IO
::
tiff
},
{
"Nicos/SANSDRaw (*.001)"
,
IO
::
nicos2D
},
{
"Nicos/SANSDRaw (*.001)"
,
IO
::
nicos2D
},
{
"BornAgain (*.int.gz)"
,
IO
::
bornagain2D
},
{
"CSV (*.csv *.dat *.tab *.txt)"
,
IO
::
csv2D
},
{
"BornAgain (*.int.gz)"
,
IO
::
bornagain2D
},
{
"REFSANS (*.csv)"
,
IO
::
refsans2D
},
{
"all (*.*)"
,
IO
::
unknown2D
}};
{
"CSV (*.csv *.dat *.tab *.txt)"
,
IO
::
csv2D
},
{
"REFSANS (*.csv)"
,
IO
::
refsans2D
},
{
"all (*.*)"
,
IO
::
unknown2D
}};
QString
filters
=
::
join_filterkeys
(
filters2D
,
";;"
);
QString
filters
=
::
join_filterkeys
(
filters2D
,
";;"
);
...
...
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