Jammy2211 / PyAutoLens

PyAutoLens: Open Source Strong Gravitational Lensing
https://pyautolens.readthedocs.io/
MIT License
159 stars 32 forks source link

Grid calculations in the ray tracing module #67

Closed Jammy2211 closed 4 years ago

Jammy2211 commented 5 years ago

Currently, if a grid is None in the grids.DataGrids class, the ray_tracing module raises an error as it cannot trace a None. To circumvent this, I have been assigning default grid values as np.array([0.0, 0.0]. This works, but is not clear and therefore we should make it so that the tracing calculations explicitly skip over any grids which are a None.

Furthermore, we currently have separate planes / tracers for tracing 'positions', which are a list of NumPy arrays corresponding to a specific sub-set of image pixels. We should be able to incorporate these positions into the DataGrids class, such that we can get rid of the Position specific classes. Because the positions are a list of numpy arrays and not a 1D numpy array like other grids, this will require the grids module / tracing functions to recognise when a grid is a position and call a map function.

Finally, the positions are used to check whether multiply imaged pixelstraces close to one another in the source plane for a given mass model. This allows us to 'skip' all the mass models which clearly give a bad result. To retain this functionoality, we should add a 'only_trace_positions' bool to the Tracer such that all other grids are omitted from the calculation.

Jammy2211 commented 4 years ago

Fixed by moving gids to methods.