Skip to content

Commit

Permalink
Switch off tests related to Shapelets, as it requires gigalens to be …
Browse files Browse the repository at this point in the history
…installed
  • Loading branch information
aymgal committed Nov 21, 2024
1 parent ec12419 commit 30d738b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
4 changes: 2 additions & 2 deletions test/LightModel/light_model_base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def test_get_class_from_string_SERSIC(self):
self.assertTrue(isinstance(profile_class, hcl.Sersic))
profile_class = LightModelBase.get_class_from_string('SERSIC_SUPERELLIPSE')
self.assertTrue(isinstance(profile_class, hcl.SersicElliptic))
profile_class = LightModelBase.get_class_from_string('SHAPELETS')
self.assertTrue(isinstance(profile_class, hcl.Shapelets))
# profile_class = LightModelBase.get_class_from_string('SHAPELETS') # requires gigalens
# self.assertTrue(isinstance(profile_class, hcl.Shapelets))

def test_get_class_from_string_PIXELATED(self):
profile_class = LightModelBase.get_class_from_string('PIXELATED')
Expand Down
37 changes: 22 additions & 15 deletions test/LightModel/light_model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,31 @@
from herculens.LightModel.profile_mapping import SUPPORTED_MODELS


# Set to True to include the Shapelets profile in the tests, but this requires gigalens
TEST_SHAPELETS = False


@pytest.fixture
def base_setup():
# Some coordinates
grid_class = hcl.PixelGrid(nx=5, ny=5)
x, y = grid_class.pixel_coordinates
kwargs_pixelated = {'num_pixels': 10}
n_max = 4
# Create an instance of the LightModel class with some initial parameters
# Replace the arguments with appropriate values for your use case
profile_list = [
hcl.SersicElliptic(),
hcl.GaussianEllipse(),
hcl.PixelatedLight(
interpolation_type='fast_bilinear', allow_extrapolation=True,
derivative_type='interpol', adaptive_grid=False
)
]
if TEST_SHAPELETS:
n_max = 4
profile_list.append(hcl.Shapelets(n_max=n_max))
light_model = LightModel(
[
hcl.SersicElliptic(),
hcl.GaussianEllipse(),
hcl.Shapelets(n_max=n_max),
hcl.PixelatedLight(
interpolation_type='fast_bilinear', allow_extrapolation=True,
derivative_type='interpol', adaptive_grid=False
)
],
profile_list,
kwargs_pixelated=kwargs_pixelated,
verbose=True,
)
Expand Down Expand Up @@ -56,15 +62,16 @@ def base_setup():
'e2': 0.034,
},
{
'pixels': np.random.randn(10, 10),
}
]
if TEST_SHAPELETS:
kwargs_light.append({
'amps': np.random.randn((n_max+1)*(n_max+2)//2),
'beta': 0.2,
'center_x': -0.02,
'center_y': 0.1,
},
{
'pixels': np.random.randn(10, 10),
}
]
})
return (x, y), light_model, kwargs_light

def get_light_model_instance(alpha_method):
Expand Down

0 comments on commit 30d738b

Please sign in to comment.