Title: Allow `squeeze` to search over non-monotonic polynomials · Issue #256 · diffpy/diffpy.morph · GitHub
Open Graph Title: Allow `squeeze` to search over non-monotonic polynomials · Issue #256 · diffpy/diffpy.morph
X Title: Allow `squeeze` to search over non-monotonic polynomials · Issue #256 · diffpy/diffpy.morph
Description: I think we should just allow squeeze to be non-monotonic. Like my previous suggestion, sort the grid (and in parallel the function values). Since we have discrete data, overlap is unlikely. In the case of overlap, take the average value ...
Open Graph Description: I think we should just allow squeeze to be non-monotonic. Like my previous suggestion, sort the grid (and in parallel the function values). Since we have discrete data, overlap is unlikely. In the ...
X Description: I think we should just allow squeeze to be non-monotonic. Like my previous suggestion, sort the grid (and in parallel the function values). Since we have discrete data, overlap is unlikely. In the ...
Opengraph URL: https://github.com/diffpy/diffpy.morph/issues/256
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Allow `squeeze` to search over non-monotonic polynomials","articleBody":"I think we should just allow `squeeze` to be non-monotonic. Like my previous suggestion, sort the grid (and in parallel the function values). Since we have discrete data, overlap is unlikely. In the case of overlap, take the average value of the overlaps. We would no longer have this error. I suggest warning the user if the final (only the final) squeeze parameters results in non-monotonicity and allowing them to disable it with another setting:\n\n```\nWarning: The squeeze morph has interpolated your morphed function from a non-monotonically increasing grid. This can result in strange behavior in the regions {list_of_regions}. To disable this setting, please enable --check-increasing.\n```\n\nIf the final result is still on a monotonic increasing grid, good! That means only the intermediates were non-monotonic. This change only benefits us since if we do not implement this, the user will see an error on all cases where the grid is non-monotonic, and they recover the same behavior using `check-increasing` (or perhaps a better name for this option).\n\nUse something like [this](https://stackoverflow.com/questions/25264798/checking-for-and-indexing-non-unique-duplicate-values-in-a-numpy-array) to find non-unique values efficiently.\n\nUse `np.diff` and check for negatives to quickly find the region where the interpolation has resulted in non-monotonicity. Specifically, for each set of continuous negative values in `np.diff(a)` for some array `a`, your non-monotonic region is `a[idx2+1]` to `a[idx1]` where `idx1` is the index of where the negative region in `np.diff(a)` starts and and `idx2` is the index where it ends. For example, if `np.diff(a)` is negative on the range `10-20`, your non-monotonic region is `a[21]` to `a[10]`. You will not have index out of bounds errors from this since `np.diff` returns an array one smaller than the original.\n\nNote that the grid size can change, but we implemented ways to handle that in `morphrgrid.py`.","author":{"url":"https://github.com/Sparks29032","@type":"Person","name":"Sparks29032"},"datePublished":"2025-09-13T21:56:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/256/diffpy.morph/issues/256"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e3f42ea3-bfcb-ebda-f9c3-b406005b5f92 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B2C6:19F72D:21409F:2CD30E:69734EE1 |
| html-safe-nonce | b8cc8dc1e29615c67c2be30f713ee518cd6cc160f0c3c6820f1346716a351cca |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMkM2OjE5RjcyRDoyMTQwOUY6MkNEMzBFOjY5NzM0RUUxIiwidmlzaXRvcl9pZCI6IjU0ODI3NDIwNDUzNzEyMjM3NzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e0c0383956cfcd5c80e8d4f04cc0bac7284278aa0a704c2029a6c91753ebd705 |
| hovercard-subject-tag | issue:3414192961 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/diffpy/diffpy.morph/256/issue_layout |
| twitter:image | https://opengraph.githubassets.com/722515768494548910c60961412f860a3963c6d6505c4b763451cfa999a5d01c/diffpy/diffpy.morph/issues/256 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/722515768494548910c60961412f860a3963c6d6505c4b763451cfa999a5d01c/diffpy/diffpy.morph/issues/256 |
| og:image:alt | I think we should just allow squeeze to be non-monotonic. Like my previous suggestion, sort the grid (and in parallel the function values). Since we have discrete data, overlap is unlikely. In the ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Sparks29032 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9c6b49fea3d431063963fbeee3309a15cb4096903286e532f663096b47b63bc6 |
| turbo-cache-control | no-preview |
| go-import | github.com/diffpy/diffpy.morph git https://github.com/diffpy/diffpy.morph.git |
| octolytics-dimension-user_id | 5612611 |
| octolytics-dimension-user_login | diffpy |
| octolytics-dimension-repository_id | 116579729 |
| octolytics-dimension-repository_nwo | diffpy/diffpy.morph |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 116579729 |
| octolytics-dimension-repository_network_root_nwo | diffpy/diffpy.morph |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 814e1d7d82db0f7eb6982bfa0395502441bb14ad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width