Repository: glass-dev/glass

Issue:
Should `multalm` be private?
### Add your issue here

`glass.fields.multalm` is available under the `glass` namespace, but it is not displayed in documentation. I was wondering, given that it is only used internally by other functions, should it be private (and not under the `glass` namespace)?

Hints from issue comments:
@ntessore: Yeah, that function is only there for the random sampling. At least for now!

Solution patch:
diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml
index 3b3b498..11eb397 100644
--- a/.github/workflows/examples.yml
+++ b/.github/workflows/examples.yml
@@ -5,11 +5,13 @@ on:
   push:
     paths:
       - glass/**
+      - examples/**
     branches:
       - main
   pull_request:
     paths:
       - glass/**
+      - examples/**
     types:
       - opened
       - ready_for_review
@@ -52,6 +54,7 @@ jobs:
 
       - name: Run examples
         run: nox -s examples
+        timeout-minutes: 20
         env:
           FORCE_COLOR: 1
 
diff --git a/examples/2-advanced/legacy-mode.ipynb b/examples/2-advanced/legacy-mode.ipynb
index b314897..f88a765 100644
--- a/examples/2-advanced/legacy-mode.ipynb
+++ b/examples/2-advanced/legacy-mode.ipynb
@@ -45,8 +45,7 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "import glass\n",
-    "import glass.ext.camb"
+    "import glass"
    ]
   },
   {
diff --git a/glass/__init__.py b/glass/__init__.py
index b9a3032..5fd9b17 100644
--- a/glass/__init__.py
+++ b/glass/__init__.py
@@ -43,7 +43,6 @@ __all__ = [
     "lognormal_fields",
     "lognormal_gls",
     "lognormal_shift_hilbert2011",
-    "multalm",
     "multi_plane_matrix",
     "multi_plane_weights",
     "nfields_from_nspectra",
@@ -96,7 +95,6 @@ from glass.fields import (
     lognormal_fields,
     lognormal_gls,
     lognormal_shift_hilbert2011,
-    multalm,
     nfields_from_nspectra,
     regularized_spectra,
     solve_gaussian_spectra,
diff --git a/glass/fields.py b/glass/fields.py
index c39fd52..8c4cea6 100644
--- a/glass/fields.py
+++ b/glass/fields.py
@@ -210,7 +210,7 @@ def cls2cov(
         yield cov
 
 
-def multalm(
+def _multalm(
     alm: NDArray[np.complex128],
     bl: NDArray[np.float64],
     *,
@@ -407,11 +407,11 @@ def _generate_grf(
 
         # scale by standard deviation of the conditional distribution
         # variance is distributed over real and imaginary part
-        alm = multalm(z, s)
+        alm = _multalm(z, s)
 
         # add the mean of the conditional distribution
         for i in range(ncorr):
-            alm += multalm(y[:, i], a[:, i])
+            alm += _multalm(y[:, i], a[:, i])
 
         # store the standard normal in y array at the indicated index
         if j is not None:


Test patch:
diff --git a/tests/test_fields.py b/tests/test_fields.py
index ced908d..043859d 100644
--- a/tests/test_fields.py
+++ b/tests/test_fields.py
@@ -173,7 +173,7 @@ def test_multalm() -> None:
     bl = np.array([2.0, 0.5, 1.0])
     alm_copy = np.copy(alm)
 
-    result = glass.multalm(alm, bl, inplace=True)
+    result = glass.fields._multalm(alm, bl, inplace=True)
 
     assert np.array_equal(result, alm)  # in-place
     expected_result = np.array([2.0, 1.0, 3.0, 2.0, 5.0, 6.0])
@@ -184,14 +184,14 @@ def test_multalm() -> None:
 
     bl = np.ones(3)
 
-    result = glass.multalm(alm, bl, inplace=False)
+    result = glass.fields._multalm(alm, bl, inplace=False)
     np.testing.assert_array_equal(result, alm)
 
     # multiple with 0s
 
     bl = np.array([0.0, 1.0, 0.0])
 
-    result = glass.multalm(alm, bl, inplace=False)
+    result = glass.fields._multalm(alm, bl, inplace=False)
 
     expected_result = np.array([0.0, 1.0, 0.0, 2.0, 0.0, 0.0])
     np.testing.assert_allclose(result, expected_result)
@@ -201,7 +201,7 @@ def test_multalm() -> None:
     alm = np.array([])
     bl = np.array([])
 
-    result = glass.multalm(alm, bl, inplace=False)
+    result = glass.fields._multalm(alm, bl, inplace=False)
     np.testing.assert_array_equal(result, alm)