Giter Club home page Giter Club logo

Comments (3)

Jammy2211 avatar Jammy2211 commented on May 28, 2024

This problem is more general throughout the code. For example, when simulating an image, we have to manually create its coordinate grid in 2D, flatten it to 1D to pass it through the galaxy / profiles modules, and then revert its intensities / deflections to 2d for the simulation. Its a similar problem in the visualization of an analysis, where we constantly revert images to 2D for plotting.

In my opinion, we need a decorator / wrapper that we can put on profile functions that says, basically, if the function is passed a 2D NumPy array / grid (or ScaledArray / Mask / Grid2D class), to map it to 1D before passing the data, get the result on this 1D grid and map it back to 2D. This (probably unmasked) 2D grid could either be stored in masked_image or generated on-the-fly using Mask.unmasked.

The ray-tracing module could then be passed a 2D grid collection (probably only using a sub grid) to generate unmasked 2D model images. Finally, we would need to change the behaviour of ProfileFitter as it performs convolution using 1D arrays (e.g. using an image and blurring-image). We could either overwrite it with a ProfileFitter2D or make another fancy decorator.

We don't need to do anything with PixelizationFitter, as the the solution is defined by the mask and we would never want to generate results outside the mask.

from pyautolens.

Jammy2211 avatar Jammy2211 commented on May 28, 2024

I am in the process of implementing the solution above and have the following notes:

  • Mapping functionality is now built into GridMapper classes, which are extensions of the ImageGrid / SubGrid classes but also have functionality to map their 1D results to 2D. These are setup using the usual Mask functions, however instead of using a circular / annulus mask they are completely unmasked (except for the blurring region edges)

  • I extended the transform_grid wrapper in profiles such that if the grid that is passed in is an instance of a GridMapper, the result that is returned (e.g. intensitites) is mapped to 2D. If the result is deflection angles, a list of 2D arrays is returned correspond to the x / y values.

  • In MaskedImage, I setup a second GridCollection which is a collection of these GridMappers (image, sub and blurring). This ensures we can seamlessly pass our mapper-grids into ray-tracing like we do normal grids.

from pyautolens.

Jammy2211 avatar Jammy2211 commented on May 28, 2024

Implemented

from pyautolens.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.