diff --git a/config/priors/mesh/rectangular_bilinear_adapt_density.yaml b/config/priors/mesh/rectangular_bilinear_adapt_density.yaml new file mode 100755 index 0000000..0c38928 --- /dev/null +++ b/config/priors/mesh/rectangular_bilinear_adapt_density.yaml @@ -0,0 +1,21 @@ +RectangularBilinearAdaptDensity: + shape_0: + type: Uniform + lower_limit: 20.0 + upper_limit: 45.0 + width_modifier: + type: Absolute + value: 8.0 + limits: + lower: 3.0 + upper: inf + shape_1: + type: Uniform + lower_limit: 20.0 + upper_limit: 45.0 + width_modifier: + type: Absolute + value: 8.0 + limits: + lower: 3.0 + upper: inf \ No newline at end of file diff --git a/config/priors/mesh/rectangular_bilinear_adapt_image.yaml b/config/priors/mesh/rectangular_bilinear_adapt_image.yaml new file mode 100755 index 0000000..71f10be --- /dev/null +++ b/config/priors/mesh/rectangular_bilinear_adapt_image.yaml @@ -0,0 +1,40 @@ +RectangularBilinearAdaptImage: + shape_0: + type: Uniform + lower_limit: 20.0 + upper_limit: 45.0 + width_modifier: + type: Absolute + value: 8.0 + limits: + lower: 3.0 + upper: inf + shape_1: + type: Uniform + lower_limit: 20.0 + upper_limit: 45.0 + width_modifier: + type: Absolute + value: 8.0 + limits: + lower: 3.0 + upper: inf + weight_power: + type : Uniform + lower_limit: 0.0 + upper_limit: 10.0 + width_modifier: + type: Absolute + value: 2.0 + limits: + lower: -100.0 + upper: 100.0 + weight_floor: + type: LogUniform + lower_limit: 0.00001 + upper_limit: 1.0 + width_modifier: + type: Absolute + limits: + lower: 0.0 + upper: inf \ No newline at end of file diff --git a/config/priors/mesh/rectangular_adapt_density.yaml b/config/priors/mesh/rectangular_rtu_adapt_density.yaml old mode 100755 new mode 100644 similarity index 88% rename from config/priors/mesh/rectangular_adapt_density.yaml rename to config/priors/mesh/rectangular_rtu_adapt_density.yaml index e78308a..2bfdb49 --- a/config/priors/mesh/rectangular_adapt_density.yaml +++ b/config/priors/mesh/rectangular_rtu_adapt_density.yaml @@ -1,21 +1,21 @@ -RectangularAdaptDensity: - shape_0: - type: Uniform - lower_limit: 20.0 - upper_limit: 45.0 - width_modifier: - type: Absolute - value: 8.0 - limits: - lower: 3.0 - upper: inf - shape_1: - type: Uniform - lower_limit: 20.0 - upper_limit: 45.0 - width_modifier: - type: Absolute - value: 8.0 - limits: - lower: 3.0 +RectangularRTUAdaptDensity: + shape_0: + type: Uniform + lower_limit: 20.0 + upper_limit: 45.0 + width_modifier: + type: Absolute + value: 8.0 + limits: + lower: 3.0 + upper: inf + shape_1: + type: Uniform + lower_limit: 20.0 + upper_limit: 45.0 + width_modifier: + type: Absolute + value: 8.0 + limits: + lower: 3.0 upper: inf \ No newline at end of file diff --git a/config/priors/mesh/rectangular_adapt_image.yaml b/config/priors/mesh/rectangular_rtu_adapt_image.yaml old mode 100755 new mode 100644 similarity index 91% rename from config/priors/mesh/rectangular_adapt_image.yaml rename to config/priors/mesh/rectangular_rtu_adapt_image.yaml index e8878be..c8ae45d --- a/config/priors/mesh/rectangular_adapt_image.yaml +++ b/config/priors/mesh/rectangular_rtu_adapt_image.yaml @@ -1,40 +1,40 @@ -RectangularAdaptImage: - shape_0: - type: Uniform - lower_limit: 20.0 - upper_limit: 45.0 - width_modifier: - type: Absolute - value: 8.0 - limits: - lower: 3.0 - upper: inf - shape_1: - type: Uniform - lower_limit: 20.0 - upper_limit: 45.0 - width_modifier: - type: Absolute - value: 8.0 - limits: - lower: 3.0 - upper: inf - weight_power: - type : Uniform - lower_limit: 0.0 - upper_limit: 10.0 - width_modifier: - type: Absolute - value: 2.0 - limits: - lower: -100.0 - upper: 100.0 - weight_floor: - type: LogUniform - lower_limit: 0.00001 - upper_limit: 1.0 - width_modifier: - type: Absolute - limits: - lower: 0.0 +RectangularRTUAdaptImage: + shape_0: + type: Uniform + lower_limit: 20.0 + upper_limit: 45.0 + width_modifier: + type: Absolute + value: 8.0 + limits: + lower: 3.0 + upper: inf + shape_1: + type: Uniform + lower_limit: 20.0 + upper_limit: 45.0 + width_modifier: + type: Absolute + value: 8.0 + limits: + lower: 3.0 + upper: inf + weight_power: + type : Uniform + lower_limit: 0.0 + upper_limit: 10.0 + width_modifier: + type: Absolute + value: 2.0 + limits: + lower: -100.0 + upper: 100.0 + weight_floor: + type: LogUniform + lower_limit: 0.00001 + upper_limit: 1.0 + width_modifier: + type: Absolute + limits: + lower: 0.0 upper: inf \ No newline at end of file diff --git a/notebooks/chapter_3_pixelizations/tutorial_10_fit_problems.ipynb b/notebooks/chapter_3_pixelizations/tutorial_10_fit_problems.ipynb index a297fcf..72d492e 100644 --- a/notebooks/chapter_3_pixelizations/tutorial_10_fit_problems.ipynb +++ b/notebooks/chapter_3_pixelizations/tutorial_10_fit_problems.ipynb @@ -10,7 +10,7 @@ "To begin, make sure you have read tutorials 4 and 5 carefully, as a clear understanding of how the Bayesian\n", "evidence works is key to understanding the adaption tutorials that close this chapter!\n", "\n", - "Earlier in this chapter (tutorial 8) we investigated two pixelizations: the `RectangularAdaptDensity` mesh and the\n", + "Earlier in this chapter (tutorial 8) we investigated two pixelizations: the `RectangularBilinearAdaptDensity` mesh and the\n", "`Delaunay` mesh with an `Overlay` image-mesh. We argued that the latter was better than the former, because it\n", "dedicated more source-pixels to the regions of the source-plane where we had more data, e.g. the high-magnification\n", "regions. Therefore, we could fit the data using fewer source pixels, which improved computational efficiency and\n", @@ -255,7 +255,7 @@ "__Fitting__\n", "\n", "we'll make one more convenience function which fits the simulated imaging data with a\n", - "`RectangularAdaptDensity` mesh and `Constant` regularization scheme pixelization.\n", + "`RectangularBilinearAdaptDensity` mesh and `Constant` regularization scheme pixelization.\n", "\n", "We'll input the `coefficient` of each fit, so that for each simulated source we regularize it at an appropriate level. \n", "There is nothing new in this function you haven't seen before." @@ -278,7 +278,7 @@ " )\n", "\n", " pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(24, 24)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(24, 24)),\n", " regularization=al.reg.Constant(coefficient=coefficient),\n", " )\n", "\n", diff --git a/notebooks/chapter_3_pixelizations/tutorial_11_brightness_adaption.ipynb b/notebooks/chapter_3_pixelizations/tutorial_11_brightness_adaption.ipynb index fdade77..666d224 100644 --- a/notebooks/chapter_3_pixelizations/tutorial_11_brightness_adaption.ipynb +++ b/notebooks/chapter_3_pixelizations/tutorial_11_brightness_adaption.ipynb @@ -165,7 +165,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Next, we're going to fit the image using the RectangularAdaptDensity magnification based grid. \n", + "Next, we're going to fit the image using the RectangularBilinearAdaptDensity magnification based grid. \n", "\n", "The code below does all the usual steps required to do this." ] @@ -185,7 +185,7 @@ ")\n", "\n", "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(24, 24)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(24, 24)),\n", " regularization=al.reg.Constant(coefficient=3.3),\n", ")\n", "\n", @@ -248,7 +248,7 @@ "Now lets take a look at brightness based adaption in action. \n", "\n", "Below, we define a source-galaxy using the `Hilbert` image-mesh (we discuss below how this adapts to the source light) \n", - "and `RectangularAdaptDensity` mesh and use this to fit the lens-data. " + "and `RectangularBilinearAdaptDensity` mesh and use this to fit the lens-data. " ] }, { @@ -262,7 +262,7 @@ ")\n", "\n", "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(24, 24)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(24, 24)),\n", " regularization=al.reg.Constant(coefficient=0.5),\n", ")\n", "\n", @@ -460,7 +460,7 @@ "\n", "\n", "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(24, 24)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(24, 24)),\n", " regularization=al.reg.Constant(coefficient=1.0),\n", ")\n", "\n", @@ -509,7 +509,7 @@ "\n", "\n", "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(24, 24)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(24, 24)),\n", " regularization=al.reg.Constant(coefficient=1.0),\n", ")\n", "\n", diff --git a/notebooks/chapter_3_pixelizations/tutorial_12_adaptive_regularization.ipynb b/notebooks/chapter_3_pixelizations/tutorial_12_adaptive_regularization.ipynb index d95f186..3dcfc61 100644 --- a/notebooks/chapter_3_pixelizations/tutorial_12_adaptive_regularization.ipynb +++ b/notebooks/chapter_3_pixelizations/tutorial_12_adaptive_regularization.ipynb @@ -188,7 +188,7 @@ "metadata": {}, "source": [ "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(24, 24)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(24, 24)),\n", " regularization=al.reg.Constant(coefficient=3.3),\n", ")\n", "\n", @@ -245,7 +245,7 @@ "adapt_image = fit.model_data.slim\n", "\n", "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(24, 24)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(24, 24)),\n", " regularization=al.reg.Adapt(\n", " inner_coefficient=0.005, outer_coefficient=1.9, signal_scale=3.0\n", " ),\n", @@ -374,7 +374,7 @@ "metadata": {}, "source": [ "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(24, 24)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(24, 24)),\n", " regularization=al.reg.Adapt(\n", " inner_coefficient=0.001, outer_coefficient=0.2, signal_scale=2.0\n", " ),\n", diff --git a/notebooks/chapter_3_pixelizations/tutorial_1_pixelizations.ipynb b/notebooks/chapter_3_pixelizations/tutorial_1_pixelizations.ipynb index 10df8e6..b0fb853 100644 --- a/notebooks/chapter_3_pixelizations/tutorial_1_pixelizations.ipynb +++ b/notebooks/chapter_3_pixelizations/tutorial_1_pixelizations.ipynb @@ -121,7 +121,7 @@ "There are multiple `Mesh`'s available. For now, we'll keep it simple and use a rectangular\n", "grid, whose `shape` defines its $(y,x)$ dimensions.\n", "\n", - "The `RectangularAdaptDensity` mesh adapts its pixels to the density of the traced source-plane\n", + "The `RectangularBilinearAdaptDensity` mesh adapts its pixels to the density of the traced source-plane\n", "grid via the ray-guided transformed uniform (RTU) grid formulation of Enzi et al. (2026)\n", "(https://arxiv.org/abs/2606.30620), which should be cited in published work using this mesh.\n", "Note that whereas that paper pairs the RTU grid with a Gaussian-process source prior,\n", @@ -132,7 +132,7 @@ "cell_type": "code", "metadata": {}, "source": [ - "mesh = al.mesh.RectangularAdaptDensity(shape=(25, 25))" + "mesh = al.mesh.RectangularBilinearAdaptDensity(shape=(25, 25))" ], "outputs": [], "execution_count": null @@ -221,11 +221,11 @@ "cell_type": "code", "metadata": {}, "source": [ - "print(\"RectangularAdaptDensity Grid2D Pixel Centre 1:\")\n", + "print(\"RectangularBilinearAdaptDensity Grid2D Pixel Centre 1:\")\n", "print(mapper.source_plane_mesh_grid[0])\n", - "print(\"RectangularAdaptDensity Grid2D Pixel Centre 2:\")\n", + "print(\"RectangularBilinearAdaptDensity Grid2D Pixel Centre 2:\")\n", "print(mapper.source_plane_mesh_grid[1])\n", - "print(\"RectangularAdaptDensity Grid2D Pixel Centre 3:\")\n", + "print(\"RectangularBilinearAdaptDensity Grid2D Pixel Centre 3:\")\n", "print(mapper.source_plane_mesh_grid[2])\n", "print(\"etc.\")" ], diff --git a/notebooks/chapter_3_pixelizations/tutorial_2_mappers.ipynb b/notebooks/chapter_3_pixelizations/tutorial_2_mappers.ipynb index c2ee7ef..205bf2f 100644 --- a/notebooks/chapter_3_pixelizations/tutorial_2_mappers.ipynb +++ b/notebooks/chapter_3_pixelizations/tutorial_2_mappers.ipynb @@ -196,7 +196,7 @@ "cell_type": "code", "metadata": {}, "source": [ - "mesh = al.mesh.RectangularAdaptDensity(shape=(25, 25))\n", + "mesh = al.mesh.RectangularBilinearAdaptDensity(shape=(25, 25))\n", "\n", "pixelization = al.Pixelization(mesh=mesh)\n", "\n", diff --git a/notebooks/chapter_3_pixelizations/tutorial_3_inversions.ipynb b/notebooks/chapter_3_pixelizations/tutorial_3_inversions.ipynb index afb3bd5..3061c81 100644 --- a/notebooks/chapter_3_pixelizations/tutorial_3_inversions.ipynb +++ b/notebooks/chapter_3_pixelizations/tutorial_3_inversions.ipynb @@ -201,7 +201,7 @@ "cell_type": "code", "metadata": {}, "source": [ - "mesh = al.mesh.RectangularAdaptDensity(shape=(25, 25))\n", + "mesh = al.mesh.RectangularBilinearAdaptDensity(shape=(25, 25))\n", "\n", "pixelization = al.Pixelization(mesh=mesh)\n", "\n", @@ -479,7 +479,7 @@ "metadata": {}, "source": [ "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(40, 40)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)),\n", " regularization=al.reg.Constant(coefficient=1.0),\n", ")\n", "\n", diff --git a/notebooks/chapter_3_pixelizations/tutorial_4_bayesian_regularization.ipynb b/notebooks/chapter_3_pixelizations/tutorial_4_bayesian_regularization.ipynb index 24c021c..b6644f6 100644 --- a/notebooks/chapter_3_pixelizations/tutorial_4_bayesian_regularization.ipynb +++ b/notebooks/chapter_3_pixelizations/tutorial_4_bayesian_regularization.ipynb @@ -197,7 +197,7 @@ "metadata": {}, "source": [ "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(40, 40)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)),\n", " regularization=al.reg.Constant(coefficient=1.0),\n", ")\n", "\n", @@ -227,7 +227,7 @@ "metadata": {}, "source": [ "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(40, 40)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)),\n", " regularization=al.reg.Constant(coefficient=0.0),\n", ")\n", "\n", @@ -300,7 +300,7 @@ "metadata": {}, "source": [ "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(40, 40)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)),\n", " regularization=al.reg.Constant(coefficient=100.0),\n", ")\n", "\n", @@ -422,7 +422,7 @@ "metadata": {}, "source": [ "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(40, 40)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)),\n", " regularization=al.reg.Constant(coefficient=1.0),\n", ")\n", "\n", diff --git a/notebooks/chapter_3_pixelizations/tutorial_5_bayesian_formalism.ipynb b/notebooks/chapter_3_pixelizations/tutorial_5_bayesian_formalism.ipynb index 852839e..ea1234c 100644 --- a/notebooks/chapter_3_pixelizations/tutorial_5_bayesian_formalism.ipynb +++ b/notebooks/chapter_3_pixelizations/tutorial_5_bayesian_formalism.ipynb @@ -236,7 +236,7 @@ "to 20 x 20 = 400 source pixels.\n", "\n", "We use the `RectangularUniform` mesh, where all rectangular source pixels have the same size, rather than the\n", - "`RectangularAdaptDensity` mesh used in the previous tutorials. The uniform mesh keeps the geometry simple, and every\n", + "`RectangularBilinearAdaptDensity` mesh used in the previous tutorials. The uniform mesh keeps the geometry simple, and every\n", "equation below applies unchanged to the adaptive meshes -- only the source pixel centres move.\n", "\n", "By default, source pixels at the edge of the mesh are forced to solutions of zero flux by the linear algebra solver.\n", @@ -365,7 +365,7 @@ "cell_type": "code", "metadata": {}, "source": [ - "from autoarray.inversion.mesh.mesh.rectangular_adapt_density import overlay_grid_from\n", + "from autoarray.inversion.mesh.mesh.rectangular_rtu_adapt_density import overlay_grid_from\n", "\n", "mesh_grid = overlay_grid_from(\n", " shape_native=mesh_shape, grid=al.Grid2DIrregular(relocated_grid)\n", diff --git a/notebooks/chapter_3_pixelizations/tutorial_6_borders.ipynb b/notebooks/chapter_3_pixelizations/tutorial_6_borders.ipynb index 6c1a7f4..bad296d 100644 --- a/notebooks/chapter_3_pixelizations/tutorial_6_borders.ipynb +++ b/notebooks/chapter_3_pixelizations/tutorial_6_borders.ipynb @@ -251,7 +251,7 @@ "metadata": {}, "source": [ "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(40, 40)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)),\n", " regularization=al.reg.Constant(coefficient=1.0),\n", ")\n", "\n", diff --git a/notebooks/chapter_3_pixelizations/tutorial_7_lens_modeling.ipynb b/notebooks/chapter_3_pixelizations/tutorial_7_lens_modeling.ipynb index ccebcce..732e420 100644 --- a/notebooks/chapter_3_pixelizations/tutorial_7_lens_modeling.ipynb +++ b/notebooks/chapter_3_pixelizations/tutorial_7_lens_modeling.ipynb @@ -213,7 +213,7 @@ ")\n", "\n", "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(20, 20)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(20, 20)),\n", " regularization=al.reg.Constant(coefficient=1.0),\n", ")\n", "\n", @@ -261,7 +261,7 @@ ")\n", "\n", "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(20, 20)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(20, 20)),\n", " regularization=al.reg.Constant(coefficient=1.0),\n", ")\n", "\n", @@ -394,7 +394,7 @@ ")\n", "\n", "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=(20, 20)),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(20, 20)),\n", " regularization=al.reg.Constant(coefficient=1.0),\n", ")\n", "\n", diff --git a/notebooks/chapter_3_pixelizations/tutorial_8_adaptive_pixelization.ipynb b/notebooks/chapter_3_pixelizations/tutorial_8_adaptive_pixelization.ipynb index 3cce15b..27ab380 100644 --- a/notebooks/chapter_3_pixelizations/tutorial_8_adaptive_pixelization.ipynb +++ b/notebooks/chapter_3_pixelizations/tutorial_8_adaptive_pixelization.ipynb @@ -180,7 +180,7 @@ "\n", "\n", "pixelization = al.Pixelization(\n", - " mesh=al.mesh.RectangularAdaptDensity(shape=mesh_shape),\n", + " mesh=al.mesh.RectangularBilinearAdaptDensity(shape=mesh_shape),\n", " regularization=al.reg.Constant(coefficient=0.5),\n", ")\n", "\n", diff --git a/scripts/chapter_3_pixelizations/tutorial_10_fit_problems.py b/scripts/chapter_3_pixelizations/tutorial_10_fit_problems.py index 2ccff98..0d1344a 100644 --- a/scripts/chapter_3_pixelizations/tutorial_10_fit_problems.py +++ b/scripts/chapter_3_pixelizations/tutorial_10_fit_problems.py @@ -5,7 +5,7 @@ To begin, make sure you have read tutorials 4 and 5 carefully, as a clear understanding of how the Bayesian evidence works is key to understanding the adaption tutorials that close this chapter! -Earlier in this chapter (tutorial 8) we investigated two pixelizations: the `RectangularAdaptDensity` mesh and the +Earlier in this chapter (tutorial 8) we investigated two pixelizations: the `RectangularBilinearAdaptDensity` mesh and the `Delaunay` mesh with an `Overlay` image-mesh. We argued that the latter was better than the former, because it dedicated more source-pixels to the regions of the source-plane where we had more data, e.g. the high-magnification regions. Therefore, we could fit the data using fewer source pixels, which improved computational efficiency and @@ -159,7 +159,7 @@ def simulate_for_source_galaxy(source_galaxy): __Fitting__ we'll make one more convenience function which fits the simulated imaging data with a -`RectangularAdaptDensity` mesh and `Constant` regularization scheme pixelization. +`RectangularBilinearAdaptDensity` mesh and `Constant` regularization scheme pixelization. We'll input the `coefficient` of each fit, so that for each simulated source we regularize it at an appropriate level. There is nothing new in this function you haven't seen before. @@ -177,7 +177,7 @@ def fit_with_Rectangular_from(dataset, mask, coefficient): ) pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(24, 24)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(24, 24)), regularization=al.reg.Constant(coefficient=coefficient), ) diff --git a/scripts/chapter_3_pixelizations/tutorial_11_brightness_adaption.py b/scripts/chapter_3_pixelizations/tutorial_11_brightness_adaption.py index e449df1..e929b4e 100644 --- a/scripts/chapter_3_pixelizations/tutorial_11_brightness_adaption.py +++ b/scripts/chapter_3_pixelizations/tutorial_11_brightness_adaption.py @@ -90,7 +90,7 @@ dataset = dataset.apply_sparse_operator() """ -Next, we're going to fit the image using the RectangularAdaptDensity magnification based grid. +Next, we're going to fit the image using the RectangularBilinearAdaptDensity magnification based grid. The code below does all the usual steps required to do this. """ @@ -105,7 +105,7 @@ ) pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(24, 24)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(24, 24)), regularization=al.reg.Constant(coefficient=3.3), ) @@ -140,7 +140,7 @@ Now lets take a look at brightness based adaption in action. Below, we define a source-galaxy using the `Hilbert` image-mesh (we discuss below how this adapts to the source light) -and `RectangularAdaptDensity` mesh and use this to fit the lens-data. +and `RectangularBilinearAdaptDensity` mesh and use this to fit the lens-data. """ image_mesh = al.image_mesh.Hilbert(pixels=500, weight_floor=0.0, weight_power=10.0) @@ -149,7 +149,7 @@ ) pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(24, 24)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(24, 24)), regularization=al.reg.Constant(coefficient=0.5), ) @@ -293,7 +293,7 @@ pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(24, 24)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(24, 24)), regularization=al.reg.Constant(coefficient=1.0), ) @@ -331,7 +331,7 @@ pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(24, 24)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(24, 24)), regularization=al.reg.Constant(coefficient=1.0), ) diff --git a/scripts/chapter_3_pixelizations/tutorial_12_adaptive_regularization.py b/scripts/chapter_3_pixelizations/tutorial_12_adaptive_regularization.py index a133646..8ec0cd6 100644 --- a/scripts/chapter_3_pixelizations/tutorial_12_adaptive_regularization.py +++ b/scripts/chapter_3_pixelizations/tutorial_12_adaptive_regularization.py @@ -98,7 +98,7 @@ def fit_via_source_galaxy_from(dataset, source_galaxy, adapt_images=None): Use the magnification based source to fit this data. """ pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(24, 24)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(24, 24)), regularization=al.reg.Constant(coefficient=3.3), ) @@ -133,7 +133,7 @@ def fit_via_source_galaxy_from(dataset, source_galaxy, adapt_images=None): adapt_image = fit.model_data.slim pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(24, 24)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(24, 24)), regularization=al.reg.Adapt( inner_coefficient=0.005, outer_coefficient=1.9, signal_scale=3.0 ), @@ -229,7 +229,7 @@ def fit_via_source_galaxy_from(dataset, source_galaxy, adapt_images=None): during lens modeling. """ pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(24, 24)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(24, 24)), regularization=al.reg.Adapt( inner_coefficient=0.001, outer_coefficient=0.2, signal_scale=2.0 ), diff --git a/scripts/chapter_3_pixelizations/tutorial_1_pixelizations.py b/scripts/chapter_3_pixelizations/tutorial_1_pixelizations.py index 98146f2..d7cf3de 100644 --- a/scripts/chapter_3_pixelizations/tutorial_1_pixelizations.py +++ b/scripts/chapter_3_pixelizations/tutorial_1_pixelizations.py @@ -57,13 +57,13 @@ There are multiple `Mesh`'s available. For now, we'll keep it simple and use a rectangular grid, whose `shape` defines its $(y,x)$ dimensions. -The `RectangularAdaptDensity` mesh adapts its pixels to the density of the traced source-plane +The `RectangularBilinearAdaptDensity` mesh adapts its pixels to the density of the traced source-plane grid via the ray-guided transformed uniform (RTU) grid formulation of Enzi et al. (2026) (https://arxiv.org/abs/2606.30620), which should be cited in published work using this mesh. Note that whereas that paper pairs the RTU grid with a Gaussian-process source prior, **PyAutoLens** instead uses its own regularization schemes, introduced later in this chapter. """ -mesh = al.mesh.RectangularAdaptDensity(shape=(25, 25)) +mesh = al.mesh.RectangularBilinearAdaptDensity(shape=(25, 25)) """ We now pass the mesh to a `Pixelization`. @@ -97,11 +97,11 @@ The `Mapper` contains lots of interesting information about our `Pixelization`, for example its `source_plane_mesh_grid` tells us where the pixel centres are located. """ -print("RectangularAdaptDensity Grid2D Pixel Centre 1:") +print("RectangularBilinearAdaptDensity Grid2D Pixel Centre 1:") print(mapper.source_plane_mesh_grid[0]) -print("RectangularAdaptDensity Grid2D Pixel Centre 2:") +print("RectangularBilinearAdaptDensity Grid2D Pixel Centre 2:") print(mapper.source_plane_mesh_grid[1]) -print("RectangularAdaptDensity Grid2D Pixel Centre 3:") +print("RectangularBilinearAdaptDensity Grid2D Pixel Centre 3:") print(mapper.source_plane_mesh_grid[2]) print("etc.") diff --git a/scripts/chapter_3_pixelizations/tutorial_2_mappers.py b/scripts/chapter_3_pixelizations/tutorial_2_mappers.py index a980779..ff270f3 100644 --- a/scripts/chapter_3_pixelizations/tutorial_2_mappers.py +++ b/scripts/chapter_3_pixelizations/tutorial_2_mappers.py @@ -94,7 +94,7 @@ We now setup a `Pixelization` and use it to create a `Mapper` via the tracer`s source-plane grid, just like we did in the previous tutorial. """ -mesh = al.mesh.RectangularAdaptDensity(shape=(25, 25)) +mesh = al.mesh.RectangularBilinearAdaptDensity(shape=(25, 25)) pixelization = al.Pixelization(mesh=mesh) diff --git a/scripts/chapter_3_pixelizations/tutorial_3_inversions.py b/scripts/chapter_3_pixelizations/tutorial_3_inversions.py index eb09720..13d011e 100644 --- a/scripts/chapter_3_pixelizations/tutorial_3_inversions.py +++ b/scripts/chapter_3_pixelizations/tutorial_3_inversions.py @@ -99,7 +99,7 @@ (Ignore the regularization input below for now, we will cover this in the next tutorial). """ -mesh = al.mesh.RectangularAdaptDensity(shape=(25, 25)) +mesh = al.mesh.RectangularBilinearAdaptDensity(shape=(25, 25)) pixelization = al.Pixelization(mesh=mesh) @@ -278,7 +278,7 @@ tracer. """ pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(40, 40)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)), regularization=al.reg.Constant(coefficient=1.0), ) diff --git a/scripts/chapter_3_pixelizations/tutorial_4_bayesian_regularization.py b/scripts/chapter_3_pixelizations/tutorial_4_bayesian_regularization.py index 2ec0d6a..69bd8df 100644 --- a/scripts/chapter_3_pixelizations/tutorial_4_bayesian_regularization.py +++ b/scripts/chapter_3_pixelizations/tutorial_4_bayesian_regularization.py @@ -107,7 +107,7 @@ def perform_fit_with_source_galaxy(dataset, source_galaxy): Okay, so lets look at our fit from the previous tutorial in more detail. we'll use a higher resolution 40 x 40 grid. """ pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(40, 40)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)), regularization=al.reg.Constant(coefficient=1.0), ) @@ -126,7 +126,7 @@ def perform_fit_with_source_galaxy(dataset, source_galaxy): 1.0. If we reduce this `coefficient` to zero, the source reconstruction goes *very* weird. """ pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(40, 40)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)), regularization=al.reg.Constant(coefficient=0.0), ) @@ -177,7 +177,7 @@ def perform_fit_with_source_galaxy(dataset, source_galaxy): So, what happens if we apply a high value for the regularization coefficient? """ pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(40, 40)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)), regularization=al.reg.Constant(coefficient=100.0), ) @@ -266,7 +266,7 @@ def perform_fit_with_source_galaxy(dataset, source_galaxy): from the value above by changing these parameters, I've set you up with a code to do so below. """ pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(40, 40)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)), regularization=al.reg.Constant(coefficient=1.0), ) diff --git a/scripts/chapter_3_pixelizations/tutorial_5_bayesian_formalism.py b/scripts/chapter_3_pixelizations/tutorial_5_bayesian_formalism.py index 939ef6d..0d268d4 100644 --- a/scripts/chapter_3_pixelizations/tutorial_5_bayesian_formalism.py +++ b/scripts/chapter_3_pixelizations/tutorial_5_bayesian_formalism.py @@ -139,7 +139,7 @@ to 20 x 20 = 400 source pixels. We use the `RectangularUniform` mesh, where all rectangular source pixels have the same size, rather than the -`RectangularAdaptDensity` mesh used in the previous tutorials. The uniform mesh keeps the geometry simple, and every +`RectangularBilinearAdaptDensity` mesh used in the previous tutorials. The uniform mesh keeps the geometry simple, and every equation below applies unchanged to the adaptive meshes -- only the source pixel centres move. By default, source pixels at the edge of the mesh are forced to solutions of zero flux by the linear algebra solver. @@ -219,7 +219,7 @@ We compute these by overlaying a uniform rectangular grid over the relocated traced grid, sized so the mesh fully contains the region of the source-plane the traced image-pixels cover, without wasted edge pixels beyond it. """ -from autoarray.inversion.mesh.mesh.rectangular_adapt_density import overlay_grid_from +from autoarray.inversion.mesh.mesh.rectangular_rtu_adapt_density import overlay_grid_from mesh_grid = overlay_grid_from( shape_native=mesh_shape, grid=al.Grid2DIrregular(relocated_grid) diff --git a/scripts/chapter_3_pixelizations/tutorial_6_borders.py b/scripts/chapter_3_pixelizations/tutorial_6_borders.py index bd72bd5..c433d43 100644 --- a/scripts/chapter_3_pixelizations/tutorial_6_borders.py +++ b/scripts/chapter_3_pixelizations/tutorial_6_borders.py @@ -139,7 +139,7 @@ def perform_fit_with_source_galaxy_mask_and_border( Note how we control the border via the `al.Settings` object's `use_border_relocator` input. """ pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(40, 40)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(40, 40)), regularization=al.reg.Constant(coefficient=1.0), ) diff --git a/scripts/chapter_3_pixelizations/tutorial_7_lens_modeling.py b/scripts/chapter_3_pixelizations/tutorial_7_lens_modeling.py index 78e9b50..41d9c2f 100644 --- a/scripts/chapter_3_pixelizations/tutorial_7_lens_modeling.py +++ b/scripts/chapter_3_pixelizations/tutorial_7_lens_modeling.py @@ -123,7 +123,7 @@ def perform_fit_with_lens__source_galaxy(dataset, lens_galaxy, source_galaxy): ) pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(20, 20)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(20, 20)), regularization=al.reg.Constant(coefficient=1.0), ) @@ -160,7 +160,7 @@ def perform_fit_with_lens__source_galaxy(dataset, lens_galaxy, source_galaxy): ) pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(20, 20)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(20, 20)), regularization=al.reg.Constant(coefficient=1.0), ) @@ -260,7 +260,7 @@ def perform_fit_with_lens__source_galaxy(dataset, lens_galaxy, source_galaxy): ) pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=(20, 20)), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=(20, 20)), regularization=al.reg.Constant(coefficient=1.0), ) diff --git a/scripts/chapter_3_pixelizations/tutorial_8_adaptive_pixelization.py b/scripts/chapter_3_pixelizations/tutorial_8_adaptive_pixelization.py index 493fb5b..4cbe3a7 100644 --- a/scripts/chapter_3_pixelizations/tutorial_8_adaptive_pixelization.py +++ b/scripts/chapter_3_pixelizations/tutorial_8_adaptive_pixelization.py @@ -100,7 +100,7 @@ pixelization = al.Pixelization( - mesh=al.mesh.RectangularAdaptDensity(shape=mesh_shape), + mesh=al.mesh.RectangularBilinearAdaptDensity(shape=mesh_shape), regularization=al.reg.Constant(coefficient=0.5), )