Skip to content
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

Transformed cube (#15) #96

Open
wants to merge 45 commits into
base: master
Choose a base branch
from

Conversation

Ali-Tehrani
Copy link
Collaborator

@Ali-Tehrani Ali-Tehrani commented Jun 12, 2020

Promolecular Transformation of a Cubic grid class. This is regarding issue #15.

Functionality

  • Transform Cubic Grid in [0,1]^3 to R^3 using promolecular.
  • Transform individual points.
  • Integration (has weak tests).
  • Jacobian of Transformation.
  • Steepest-ascent of a function in Theta space.
  • Directional derivatives in Theta space (Not Tested).
  • Instead of [0,1]^3, change to [-1, 1]^3 and in docs (a35a07e).
  • Added dynamic bracketing (b8fc2b2).
  • Added Cubic Grid as Tensor Product of OneD grids (c104ac6).
  • Added tolerance and using masked arrays for integration (eb32897).
  • Hessian of transformation (9e73400)
  • Interpolation and Derivative Interpolation (8727c0a).
  • Python dataclass is not in py36 (187c00e).

TODO

  • Make/Reduce tests faster
  • Vectorize Logarithm Interpoaltion
  • Test for Directional Derivative.

May 16, 2023. All of the TODO except for the "Directional derivative tests" are now fixed/added.

Added the transformation from real space to unit cube
using the Promolecular density function of a single
coordinate.
Added the inverse transformation from unit-cube to
real space using a root-solver of a single coordinate.
* Promolecular Cubic Grid Transformation is added.
* Bracket initalization is added as private func.
* Padding multiple arrays with zeros is added st have array size.
* Full Grid transformation from unit-cube to real space.
Follows changes were made
- Added and Fixed docuentation.
- Added jacobian of transformation
- Added steepest-ascent
- Added utility to transform individual points
@codecov
Copy link

codecov bot commented Jun 12, 2020

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Comparison is base (df822cf) 100.00% compared to head (187c00e) 99.12%.
Report is 268 commits behind head on master.

❗ Current head 187c00e differs from pull request most recent head 435577e. Consider uploading reports for the commit 435577e to get more accurate results

Files Patch % Lines
src/grid/protransform.py 95.30% 14 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##            master      #96      +/-   ##
===========================================
- Coverage   100.00%   99.12%   -0.88%     
===========================================
  Files           14       14              
  Lines         1385     1592     +207     
===========================================
+ Hits          1385     1578     +193     
- Misses           0       14      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Private data class that holds the coefficients, exponents, dimensions
and compute its density.
From code review, it was not necessary.
Providing number of points seems more natural than
providing the stepsize for Promolecular
Cubic, Uniform Grid Transformation.
Code review suggestion to use masked arrays
for boundary points and small values of promolecular
with a user-defined tolerance.
Suggested in code review, able to handle
insufficient brackets.
Cubic grid is a tensor product of one-dimensional grids.
Promolecular transform is modeled on a cubic grid.
Since the bounds [-1, 1] is used in onedgrids.py,
the default bounds is changed to be consistent.
Since cubic grids are not supported, I tested
integration with GaussChebslev oned grid.
Added
- convert index to indices to grid transform
- convert indices to index to grid transform
- interpolation and its derivative
- hessian
dataclass is included in python3.7.
Acknowledgement to Derrick
Also removed an if statement that
wasnt really needed and to improve coverage
@FarnazH FarnazH requested a review from tovrstra August 12, 2020 18:53
@FarnazH
Copy link
Member

FarnazH commented Aug 31, 2021

@Ali-Tehrani does this need to be dusted off after the cubic grid is merged? If not, is it ready to be reviewed?

@PaulWAyers
Copy link
Member

PaulWAyers commented May 4, 2023

- Makes it easier for viewing and generalizes some
test to work over a wider range of points
- Makes it consistent for the cubic grid class
Useful for promolecular transformation
- Useful for promolecular transform where the grid to interpolate
  is different
- Make inteprolate its own function due to problems with
  sub-classing in python
- Needed to say a point is on the boundary
- Matches the HyperRectangle class
@Ali-Tehrani
Copy link
Collaborator Author

Added new changes:

  • It is a subclass of the base-class Hyper-Rectangle class in cubic
  • Interpolation in cubic.py only worked for a single point when use_log=True and derivatives are wanted. This is now fixed and the tests were updated.
  • Promolecular Transform Tests were updated, improved and randomized over a grid of points rather than a fixed set.
  • Interpolation with Promol Transform now works.
  • The requirement that promolecular transform requires boundary is removed and now works over any grid

@FarnazH FarnazH added the enhancement New feature or request label Oct 26, 2023
@FarnazH FarnazH removed the request for review from tczorro November 17, 2023 15:34
@FarnazH FarnazH added the future feature New feature that is coming soon label Jan 3, 2024
@PaulWAyers
Copy link
Member

This is not urgent, but in the interest of getting it (eventually) merged, I've assigned @marco-2023 to it. @marco-2023 we can talk about this at some point. One nice feature of this grid is that it is easy to adapt, at least in principle.

The easiest way to iteratively refine the grid is to take each grid point and identify its closest neighbors. The value of $f(\mathbf{r}_k)$ should ideally be very similar for these points; in particular we would like the second derivative of $f(\mathbf{r})$, times the square of the step-size in a given direction, to be small. One can iteratively refine by subdividing cubes until this quantity is sufficiently negligible.

This would need to be thought through carefully, but this is the basic idea. It is a reasonably efficient procedure once an initial kd-tree is constructed, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request future feature New feature that is coming soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants