-
Notifications
You must be signed in to change notification settings - Fork 10
BiorthBasis::Cylinder deprojection improvements #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
The9Cat
wants to merge
84
commits into
devel
Choose a base branch
from
Toomre
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 42 commits
Commits
Show all changes
84 commits
Select commit
Hold shift + click to select a range
494c619
Added a Toomre-type disk for deprojection primarily
The9Cat c7bf5ee
Added an enum and reflector for deprojection disk types and included …
The9Cat 6efc024
Addded a test routine for Abel deprojection; updated EmpCylSL for der…
22adb60
Missing source driver file
b12a1f8
Missing test class
3cf4d6c
Potential fix for pull request finding
The9Cat a03bbe6
Potential fix for pull request finding
The9Cat 4042544
Potential fix for pull request finding
The9Cat db0e02d
Potential fix for pull request finding
The9Cat dfc99f9
Potential fix for pull request finding
The9Cat 2e6fee4
Potential fix for pull request finding
The9Cat 204d43d
Add a test routine from EmpDeproj alone; fix parsing error in testEmp…
0e82cb6
Updated parsing in BiorthBasis::Cylindrical for deprojection
The9Cat cb5e150
Potential fix for pull request finding
The9Cat 5f151bc
Potential fix for pull request finding
The9Cat b761050
Potential fix for pull request finding
The9Cat 25f893d
Potential fix for pull request finding
The9Cat f9a6ae2
Potential fix for pull request finding
The9Cat 5a66623
Potential fix for pull request finding
The9Cat 4175b1e
Potential fix for pull request finding
The9Cat 31dad72
Potential fix for pull request finding
The9Cat 9c2f36f
Potential fix for pull request finding
The9Cat 22b6493
Use new sech^2 scaling
84bef8f
Merge branch 'Toomre' of github.com:EXP-code/EXP into Toomre
9439daa
Python deprojection test routine; add possibility of a separate Pytho…
1d50ae5
Fix typo in parameter assignment
The9Cat eb1f9eb
Remove the initial test function; add doc strings to the help stanza …
6402d49
Only print deprojection info from one node
5b0aa7d
Merge branch 'devel' into Toomre
The9Cat c934a79
Potential fix for pull request finding
The9Cat 5a95b50
Potential fix for pull request finding
The9Cat 402dc25
Potential fix for pull request finding
The9Cat 4513d2a
Potential fix for pull request finding
The9Cat e719f9f
Potential fix for pull request finding
The9Cat 627de49
Potential fix for pull request finding
The9Cat f5a39b4
Potential fix for pull request finding
The9Cat b6f5c03
Potential fix for pull request finding
The9Cat 3dcafad
Potential fix for pull request finding
The9Cat 8e5872e
Potential fix for pull request finding
The9Cat 79e0233
Initial plan
Copilot 9c0d024
Fix clang build: change constexpr to const for pi = std::acos(-1.0)
Copilot 5aed459
Merge pull request #209 from EXP-code/copilot/sub-pr-208
The9Cat 45a578f
Potential fix for pull request finding
The9Cat 36120a3
Potential fix for pull request finding
The9Cat 1b1f297
Potential fix for pull request finding
The9Cat fdb16ed
Potential fix for pull request finding
The9Cat d240679
Potential fix for pull request finding
The9Cat 18b1455
Accidentally deleted the 'logr' key; restored
ab91951
Apply suggestions from code review
michael-petersen 446d52b
add version number increment proposal
michael-petersen cb3c977
erroneous const breaking compile
michael-petersen 0fdaf62
Merge branch 'devel' into Toomre
michael-petersen ccd4630
Added first implemenation for saving and reading DTYPE and Python md5…
6acbe73
Added ptype support to the Cylindrical cache
8dcc0a8
Clean up the unique_ptr using a custom deleter
9d11213
restore testED binary
michael-petersen cc7f53e
Added standalone md5 hash code to avoid problems with Mac and Windows…
11987e5
Added missing md5 hash test code
fc16ed9
Additional cache failure info for debug
31925de
Need to define DTYPE before cache check
f40f1ed
Updates on the n-body side to handle conditioning types
8f52405
A few minor checks for md5 tests; requires a GNU/Linux system
f608704
Add more HDF5 diagnostics
e02eb78
Fix mistake in storing pyname info vector
8cba2a7
Additional comments [no CI]
20eb5af
Missing '.py' suffix in md5 file call
d60f5e3
Identify member function errors in Cylinder [no CI]
26a896c
Added more diagnostics
82062e9
More comments and output update with debugging info
26a85cc
Merge branch 'Toomre' of github.com:EXP-code/EXP into Toomre
e641cc5
Wrong tag type on read
b10c2ef
Try to autodeduce the HighFive types for simplicity
8e6ed66
More nested checking for Cylinder
e40d6ad
Remove duplicateed DiskType check
2f874d7
Additional comments only [No CI]
82de030
Attempted to fix garbled deprojection logic in BiorthBasis and EmpCylSL
b23224b
Missing case transformation for dmodel
fe2e667
Additional comments only [no ci]
567f005
Minor sanity-check logic tweak
5fc1198
Add defaults for mtype and dtype to Cylinder
0c49ed0
Deduplicate cache tags, oops
2ef3aba
Added automatic output of valid EmpModel types
73a47f6
Added deprojection support to Cylinder
22e1779
Missing suffixes for Python modules
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #ifndef CUBIC_SPLINE_H | ||
| #define CUBIC_SPLINE_H | ||
|
|
||
| #include <vector> | ||
|
|
||
| namespace Deproject | ||
| { | ||
|
|
||
| class CubicSpline { | ||
| public: | ||
| CubicSpline() = default; | ||
| CubicSpline(const std::vector<double>& x_in, const std::vector<double>& y_in); | ||
|
|
||
| // set data (x must be strictly increasing) | ||
| void set_data(const std::vector<double>& x_in, const std::vector<double>& y_in); | ||
|
|
||
| // evaluate spline and its derivative (xx is expected in [xmin(), xmax()]; values outside are extrapolated using the end intervals) | ||
| double eval(double xx) const; | ||
| double deriv(double xx) const; | ||
|
|
||
| double xmin() const; | ||
| double xmax() const; | ||
|
|
||
| private: | ||
| std::vector<double> x_, y_, y2_; | ||
| int locate(double xx) const; | ||
| }; | ||
|
|
||
| } | ||
|
|
||
| #endif // CUBIC_SPLINE_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| #include <stdexcept> | ||
|
|
||
| #include "CubicSpline.H" | ||
|
|
||
| namespace Deproject | ||
| { | ||
|
|
||
| CubicSpline::CubicSpline(const std::vector<double>& x_in, const std::vector<double>& y_in) { | ||
| set_data(x_in, y_in); | ||
| } | ||
|
|
||
| void CubicSpline::set_data(const std::vector<double>& x_in, const std::vector<double>& y_in) { | ||
| x_ = x_in; | ||
| y_ = y_in; | ||
| int n = (int)x_.size(); | ||
| if (n < 2 || (int)y_.size() != n) throw std::runtime_error("CubicSpline: need at least two points and equal-sized x,y."); | ||
|
|
||
| y2_.assign(n, 0.0); | ||
| std::vector<double> u(n - 1, 0.0); | ||
|
|
||
| // natural spline boundary conditions (second derivatives at endpoints = 0) | ||
| for (int i = 1; i < n - 1; ++i) { | ||
| double sig = (x_[i] - x_[i-1]) / (x_[i+1] - x_[i-1]); | ||
| double p = sig * y2_[i-1] + 2.0; | ||
| y2_[i] = (sig - 1.0) / p; | ||
| double dY1 = (y_[i+1] - y_[i]) / (x_[i+1] - x_[i]); | ||
| double dY0 = (y_[i] - y_[i-1]) / (x_[i] - x_[i-1]); | ||
| u[i] = (6.0 * (dY1 - dY0) / (x_[i+1] - x_[i-1]) - sig * u[i-1]) / p; | ||
| } | ||
|
|
||
| for (int k = n - 2; k >= 0; --k) y2_[k] = y2_[k] * y2_[k+1] + u[k]; | ||
| } | ||
|
|
||
| int CubicSpline::locate(double xx) const { | ||
| int n = (int)x_.size(); | ||
| if (xx <= x_.front()) return 0; | ||
| if (xx >= x_.back()) return n - 2; | ||
| int lo = 0, hi = n - 1; | ||
| while (hi - lo > 1) { | ||
| int mid = (lo + hi) >> 1; | ||
| if (x_[mid] > xx) hi = mid; else lo = mid; | ||
| } | ||
| return lo; | ||
| } | ||
|
|
||
| double CubicSpline::eval(double xx) const { | ||
| int klo = locate(xx); | ||
| int khi = klo + 1; | ||
| double h = x_[khi] - x_[klo]; | ||
| if (h <= 0.0) throw std::runtime_error("CubicSpline::eval: non-increasing x."); | ||
| double A = (x_[khi] - xx) / h; | ||
| double B = (xx - x_[klo]) / h; | ||
| double val = A * y_[klo] + B * y_[khi] | ||
| + ((A*A*A - A) * y2_[klo] + (B*B*B - B) * y2_[khi]) * (h*h) / 6.0; | ||
| return val; | ||
| } | ||
|
|
||
| double CubicSpline::deriv(double xx) const { | ||
| int klo = locate(xx); | ||
| int khi = klo + 1; | ||
| double h = x_[khi] - x_[klo]; | ||
| if (h <= 0.0) throw std::runtime_error("CubicSpline::deriv: non-increasing x."); | ||
| double A = (x_[khi] - xx) / h; | ||
| double B = (xx - x_[klo]) / h; | ||
| double dy = (y_[khi] - y_[klo]) / h | ||
| + ( - (3.0*A*A - 1.0) * y2_[klo] + (3.0*B*B - 1.0) * y2_[khi] ) * (h / 6.0); | ||
| return dy; | ||
| } | ||
|
|
||
| double CubicSpline::xmin() const { return x_.front(); } | ||
| double CubicSpline::xmax() const { return x_.back(); } | ||
|
|
||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.