generate required metrics and plot them to one concise plot

This commit is contained in:
CDaut 2024-06-06 01:16:29 +02:00
parent 76f6bf62a4
commit c4b12e8ef2
Signed by: clara
GPG key ID: 223391B52FAD4463
18 changed files with 1056191 additions and 4239 deletions

2
.idea/.name generated
View file

@ -1 +1 @@
vk_raytracing_tutorial utk_tests

2
.idea/misc.xml generated
View file

@ -3,7 +3,7 @@
<component name="CMakePythonSetting"> <component name="CMakePythonSetting">
<option name="pythonIntegrationState" value="YES" /> <option name="pythonIntegrationState" value="YES" />
</component> </component>
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$/raytracer"> <component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$/utk_experiments">
<contentRoot DIR="$PROJECT_DIR$" /> <contentRoot DIR="$PROJECT_DIR$" />
</component> </component>
</project> </project>

View file

@ -1,43 +1,88 @@
#include <utk/utils/PointsetIO.hpp> #include "utk/metrics/PCF.hpp"
#include <utk/utils/Pointset.hpp>
#include <utk/samplers/SamplerStep.hpp>
#include <utk/metrics/RadialSpectrum.hpp> #include <utk/metrics/RadialSpectrum.hpp>
#include <utk/samplers/SamplerStep.hpp>
#include <utk/utils/Pointset.hpp>
#include <utk/utils/PointsetIO.hpp>
#define DIMENSION 1025 #define DIMENSION 1025
#define NSAMPLES 4096 #define NSAMPLES 4096
#define NBINS 1000
#define SEED 8970
int main() template <typename T>
{ void writeSpectrumToFile(const std::string &filename, std::vector<T> spectrum) {
utk::Pointset<long double> points;
//sample points using heck
utk::SamplerStep sampler{
0.606,
8,
};
std::cout << "generating samples…" << std::endl;
if(sampler.generateSamples(points, NSAMPLES))
{
std::cout << "computing spectrum…" << std::endl;
auto result = utk::Spectrum{DIMENSION, true}.compute(points);
std::ofstream pointFile;
pointFile.open("points.txt");
pointFile << NSAMPLES << std::endl;
write_text_pointset("points.txt", points);
std::ofstream file; std::ofstream file;
file.open("spectrum.txt"); file.open(filename);
file << DIMENSION << std::endl; file << DIMENSION << std::endl;
for(auto freq : result) for (auto freq : spectrum) {
{ file << std::setprecision(std::numeric_limits<long double>::digits10 + 2)
file << std::setprecision(std::numeric_limits<long double>::digits10 + 2) << std::fixed; << std::fixed;
file << freq << std::endl; file << freq << std::endl;
} }
}
template <typename T>
void writePCFToFile(const std::string &filename, std::vector<T> spectrum) {
std::ofstream file;
file.open(filename);
for (auto freq : spectrum) {
file << std::setprecision(std::numeric_limits<long double>::digits10 + 2)
<< std::fixed;
file << freq << std::endl;
} }
} }
template <typename T>
void writeRadspecToFile(const std::string &filename,
std::pair<std::vector<T>, std::vector<T>> radspec) {
std::ofstream file;
file.open(filename);
auto xs = radspec.first;
auto ys = radspec.second;
if (xs.size() != ys.size()) {
std::cerr << "Dimensions of radial spactrum are unequal: xDim: "
<< xs.size() << " yDim: " << ys.size() << std::endl;
std::terminate();
}
for (int i = 0; i < xs.size(); ++i) {
file << std::setprecision(std::numeric_limits<long double>::digits10 + 2)
<< std::fixed;
file << xs[i] << ", " << ys[i] << std::endl;
}
}
int main() {
// load Points from file and generate metrics
auto loadedPoints =
utk::read_pointsets<long double>("../result_data/sampled.txt")[0];
auto pointView =
utk::Pointset<long double>::View(loadedPoints.Data(), NSAMPLES, 2);
// Radial spectrum
std::cout << "Calculating radial spectrum with " << NBINS
<< " bins and resolution " << DIMENSION << std::endl;
auto radSpec =
utk::RadialSpectrum(NBINS, 0.5, DIMENSION, true).compute(pointView);
writeRadspecToFile("radSpec.txt", radSpec);
// PCF
std::cout << "Calculating PCF with " << NBINS << " bins…" << std::endl;
auto pcf = utk::PCF{true, 0.01, 0.5, NBINS, 0.001}.compute(pointView);
writePCFToFile("pcf.txt", pcf);
// FFT based spectrum
std::cout << "Calculating spectrum with resolution " << DIMENSION << ""
<< std::endl;
auto spec = utk::Spectrum{DIMENSION, true}.compute(pointView);
writeSpectrumToFile("spectrum.txt", spec);
}

View file

@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 MiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 MiB

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 798 KiB

View file

@ -0,0 +1,182 @@
0.00000000000000000000, 0.01109611635215739264
0.06250000000000000000, 0.00549914066691642808
0.12500000000000000000, 0.00734698254085238911
0.18750000000000000000, 0.01037757511868205687
0.25000000000000000000, 0.01588087531856172010
0.31250000000000000000, 0.02065671548252727937
0.37500000000000000000, 0.02571341680774385501
0.43750000000000000000, 0.03840303893456557991
0.50000000000000000000, 0.13887036582395079346
0.56250000000000000000, 0.80483027521764486029
0.62500000000000000000, 1.00104140409302579638
0.68750000000000000000, 1.00258058145840983546
0.75000000000000000000, 0.98404922308968384838
0.81250000000000000000, 0.99968709142470825067
0.87500000000000000000, 0.98634114266713907699
0.93750000000000000000, 0.99207222320712547665
1.00000000000000000000, 0.99697130539317135590
1.06250000000000000000, 0.98981376025196026938
1.12500000000000000000, 1.00756209473530224379
1.18750000000000000000, 1.00612635753057513106
1.25000000000000000000, 0.99118909462972507230
1.31250000000000000000, 1.01323057281623025473
1.37500000000000000000, 0.99735140112633832835
1.43750000000000000000, 0.99358430554224505142
1.50000000000000000000, 1.00110791988485639602
1.56250000000000000000, 0.99491212080609538507
1.62500000000000000000, 1.00302785843595521867
1.68750000000000000000, 0.99578945388363354087
1.75000000000000000000, 0.99063049249586833270
1.81250000000000000000, 1.02776043192621834791
1.87500000000000000000, 0.98365739839926403279
1.93750000000000000000, 1.00917210968422273209
2.00000000000000000000, 1.00744887624815150282
2.06250000000000000000, 0.98531831476063763632
2.12500000000000000000, 1.00834055174257189609
2.18750000000000000000, 1.00280165617738622986
2.25000000000000000000, 1.00851353959164557323
2.31250000000000000000, 1.00064871814856323989
2.37500000000000000000, 0.97861931198289519841
2.43750000000000000000, 1.00970922075364178913
2.50000000000000000000, 0.98382502999211557003
2.56250000000000000000, 0.99695727025309965153
2.62500000000000000000, 1.00199283064076604993
2.68750000000000000000, 1.00679090161281861325
2.75000000000000000000, 1.01643115922143235908
2.81250000000000000000, 0.99867128348714841369
2.87500000000000000000, 0.98353508898639570361
2.93750000000000000000, 1.00137638151516115167
3.00000000000000000000, 1.01243508326136643423
3.06250000000000000000, 1.00030587898363213818
3.12500000000000000000, 0.97881551941782877634
3.18750000000000000000, 0.99789703321684530076
3.25000000000000000000, 1.01118162765954030722
3.31250000000000000000, 0.99828103715759625012
3.37500000000000000000, 0.99049498930697918447
3.43750000000000000000, 1.00216092104983638068
3.50000000000000000000, 1.00272062730552430148
3.56250000000000000000, 0.99201081402071613268
3.62500000000000000000, 0.99999079245589174349
3.68750000000000000000, 1.01124840497057824640
3.75000000000000000000, 0.99706996333424415473
3.81250000000000000000, 1.01540499928306633638
3.87500000000000000000, 0.99370531904773210056
3.93750000000000000000, 1.00029087559662596327
4.00000000000000000000, 1.01660277703017143424
4.06250000000000000000, 0.98716886505808790491
4.12500000000000000000, 1.01506743792602756413
4.18750000000000000000, 0.98282158721650617555
4.25000000000000000000, 0.98681028982597798570
4.31250000000000000000, 1.00092099988683030996
4.37500000000000000000, 1.01803339399482648225
4.43750000000000000000, 1.00713420652655577081
4.50000000000000000000, 1.00699957762684781464
4.56250000000000000000, 1.02499475286426790211
4.62500000000000000000, 0.97346218737955037768
4.68750000000000000000, 0.99601357637996782747
4.75000000000000000000, 0.99490064727416255335
4.81250000000000000000, 0.98433738337317320405
4.87500000000000000000, 0.99998615266110987192
4.93750000000000000000, 1.00627804110489954320
5.00000000000000000000, 1.01583916652653106930
5.06250000000000000000, 0.98455528995540394246
5.12500000000000000000, 0.99381460180023598690
5.18750000000000000000, 1.01257703967672960631
5.25000000000000000000, 0.99473307604643443510
5.31250000000000000000, 1.00342192004696195945
5.37500000000000000000, 0.99704492370774600631
5.43750000000000000000, 0.98601717111956346416
5.50000000000000000000, 0.99499564788637109473
5.56250000000000000000, 1.01992418912116487059
5.62500000000000000000, 0.99055561092159175008
5.68750000000000000000, 0.99545394310196867255
5.75000000000000000000, 1.00563487933626790445
5.81250000000000000000, 0.98969500021189742742
5.87500000000000000000, 1.00960619632624867229
5.93750000000000000000, 1.00148710236206869601
6.00000000000000000000, 1.00796167173066913091
6.06250000000000000000, 1.00767508769862581077
6.12500000000000000000, 1.01992737514390095885
6.18750000000000000000, 0.96864892815363824713
6.25000000000000000000, 0.99431882151141871200
6.31250000000000000000, 1.01337498941126221319
6.37500000000000000000, 0.99824837963309055272
6.43750000000000000000, 0.99323016632655416206
6.50000000000000000000, 1.00978807464050058661
6.56250000000000000000, 1.00878739802544298450
6.62500000000000000000, 0.99256021530538650495
6.68750000000000000000, 0.99900219788754532541
6.75000000000000000000, 0.97222918907888727333
6.81250000000000000000, 0.99086863290493792684
6.87500000000000000000, 1.02149434756545549234
6.93750000000000000000, 0.99391506934817752688
7.00000000000000000000, 1.00878909753790346174
7.06250000000000000000, 0.99326561138346329994
7.12500000000000000000, 1.01262654982960038702
7.18750000000000000000, 0.99039863029244705911
7.25000000000000000000, 1.00351197388721798760
7.31250000000000000000, 1.00644069558608226450
7.37500000000000000000, 1.00902444184056107931
7.43750000000000000000, 1.00001491412585891366
7.50000000000000000000, 0.99981274095373892310
7.56250000000000000000, 1.00576006475835283958
7.62500000000000000000, 0.99947483977394734929
7.68750000000000000000, 0.99402522042430295496
7.75000000000000000000, 0.99552307328749636725
7.81250000000000000000, 1.01040555993460299644
7.87500000000000000000, 0.98064836065738363112
7.93750000000000000000, 0.99407810951419784085
8.00000000000000000000, 0.99330600365820517859
8.06250000000000000000, 0.99787922933087197752
8.12500000000000000000, 0.99525948734998938468
8.18750000000000000000, 1.02333485471786382484
8.25000000000000000000, 1.01697897189399594545
8.31250000000000000000, 1.00838541121387506789
8.37500000000000000000, 0.98515471855663809585
8.43750000000000000000, 1.01067075874503750881
8.50000000000000000000, 0.98405391528205681044
8.56250000000000000000, 0.99385945577329663759
8.62500000000000000000, 1.00562356360492325888
8.68750000000000000000, 1.00151994125981682845
8.75000000000000000000, 1.00637212504905541443
8.81250000000000000000, 1.01501089624614816568
8.87500000000000000000, 1.00086793597724093066
8.93750000000000000000, 0.99292977187901200291
9.00000000000000000000, 0.98801307275715771869
9.06250000000000000000, 0.97280814751720154501
9.12500000000000000000, 0.99858420844132798129
9.18750000000000000000, 0.97796010818345621322
9.25000000000000000000, 0.98365830829192632925
9.31250000000000000000, 0.99358530893076242910
9.37500000000000000000, 1.03336480446353739528
9.43750000000000000000, 0.98566760759862467780
9.50000000000000000000, 0.99876567427271535204
9.56250000000000000000, 1.02363279142957742040
9.62500000000000000000, 1.00920179343619997858
9.68750000000000000000, 1.01805687676792367097
9.75000000000000000000, 1.02769429406932606003
9.81250000000000000000, 0.99980298659787639973
9.87500000000000000000, 1.02415353455682483380
9.93750000000000000000, 0.97866449960524736379
10.00000000000000000000, 0.99680553061936206979
10.06250000000000000000, 0.97151144023987863355
10.12500000000000000000, 0.99872594880615054712
10.18750000000000000000, 1.00795933486436043098
10.25000000000000000000, 1.01096660057330749920
10.31250000000000000000, 1.03119911130983160142
10.37500000000000000000, 0.97963053043607371297
10.43750000000000000000, 1.00234865196380891050
10.50000000000000000000, 0.98978407896001883504
10.56250000000000000000, 1.00466649677347035267
10.62500000000000000000, 0.97227114300117810868
10.68750000000000000000, 0.98837323297952461149
10.75000000000000000000, 1.01859199799058312841
10.81250000000000000000, 0.94963004875969017361
10.87500000000000000000, 0.96840576339403038649
10.93750000000000000000, 1.01651883837805987864
11.00000000000000000000, 1.03094950773836461740
11.06250000000000000000, 1.04955392696277021738
11.12500000000000000000, 1.09588406862990011853
11.18750000000000000000, 1.01039181278139016899
11.25000000000000000000, 0.83651694342605683056
11.31250000000000000000, 1.04000086235465571266

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 MiB

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 MiB