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

Plan to Restructure/Rewrite manipulations.py #46

Open
ehewins opened this issue Aug 24, 2023 · 0 comments · May be fixed by #47
Open

Plan to Restructure/Rewrite manipulations.py #46

ehewins opened this issue Aug 24, 2023 · 0 comments · May be fixed by #47

Comments

@ehewins
Copy link
Contributor

ehewins commented Aug 24, 2023

Is your feature request related to a problem? Please describe.
As it stands, the file sasdata/data_util/manipulations.py is in a very disorderly state. Many of the variables are badly named, large parts of code duplicates functionality, and several bits of code are either obsolete or are not reached in runtime.
The biggest problem however is that each of the averagers goes about its job in a slightly unique way. This makes any future overhauls (such as fractional binning) exponentially more difficult to implement. The abstract methodology behind each of the slicers is fairly universal however, so there should be plenty of opportunity for generalisation and simplification with some restructuring of the classes.

Describe the solution you'd like
Broadly speaking, the data processors in manipulations.py fit into two categories: the whole-region type and the directional type. The whole-region type includes Boxsum and Boxavg currently, but with a successfully generalised method it should be easy to add more of this type with various shaped ROIs (regions of interest). Once it has been determined what data is inside the ROI, the process for calculating sums and averages should be universal. The directional type includes all of the others, which return a Data1D object instead of a numerical result. These have the common feature of averaging the intensity along one coordinate axis, returning data to be plotted against the other. This type can be sub-categorised into ones which specify the ROI limits using Cartesian coordinates (SlabX and SlabY) and ones which use polar coordinates (all the rest). There is further subdivision of the polar kind into Q averagers and Phi averagers, as well as those which use the whole range of a given coordinate axis, or a user-specified region.

The aim is a class structure which reflects the hierarchy described above, using methods which are common between subclasses wherever possible. The rewrite should keep future overhauls to binning in mind, as binning depends heavily on the ROI geometry.

@ehewins ehewins linked a pull request Sep 17, 2023 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant