Lines from Grid objects

Grids that have been post-processed through a photoionisation code (e.g. Cloudy) contain information on emission lines. These can be loaded like regular grids, but there are a number of additional methods for working with lines, as demonstrated in these examples.

[1]:
import matplotlib.pyplot as plt
import numpy as np

from synthesizer.emissions import line_ratios
from synthesizer.emissions.utils import (
    Hb,
    O3b,
    O3r,
)
from synthesizer.grid import Grid

Next let’s initialise a grid:

[2]:
grid_dir = "../../../tests/test_grid"
grid_name = "test_grid"
grid = Grid(grid_name, grid_dir=grid_dir)

We can easily get a list of the available lines:

[3]:
print(grid.available_lines)
['He 2 1025.27A' 'O 6 1031.91A' 'O 6 1037.61A' 'He 2 1084.94A'
 'Si 2 1179.59A' 'Si 3 1206.50A' 'He 2 1215.13A' 'H 1 1215.67A'
 'O 5 1218.34A' 'N 5 1238.82A' 'N 5 1242.80A' 'Si 2 1260.42A'
 'Si 2 1264.74A' 'Si 2 1265.00A' 'O 1 1302.17A' 'O 1 1304.86A'
 'O 1 1306.03A' 'C 2 1334.53A' 'C 2 1335.66A' 'C 2 1335.71A'
 'Si 4 1393.75A' 'O 4 1399.78A' 'O 4 1401.16A' 'Si 4 1402.77A'
 'O 4 1404.81A' 'O 4 1407.38A' 'N 4 1486.50A' 'Si 2 1526.71A'
 'Si 2 1533.43A' 'C 4 1548.19A' 'C 4 1550.77A' 'Ne 4 1601.45A'
 'He 2 1640.41A' 'O 1 1641.31A' 'C 1 1657.91A' 'O 3 1660.81A'
 'O 3 1666.15A' 'Al 2 1670.79A' 'N 3 1749.67A' 'Mg 6 1806.00A'
 'Si 3 1882.71A' 'Si 3 1892.03A' 'C 3 1906.68A' 'C 3 1908.73A'
 'C 1 1992.01A' 'Si 7 2146.64A' 'O 3 2320.95A' 'C 2 2325.40A'
 'C 2 2326.93A' 'Fe 2 2395.63A' 'Fe 2 2399.24A' 'Fe 2 2406.66A'
 'Fe 2 2410.52A' 'C 1 2582.90A' 'Fe 2 2598.37A' 'Fe 2 2607.09A'
 'Fe 2 2611.87A' 'Fe 2 2613.82A' 'Fe 2 2625.67A' 'Fe 2 2628.29A'
 'Mg 7 2628.89A' 'Fe 2 2631.05A' 'Fe 2 2631.32A' 'Mg 5 2782.76A'
 'Mg 2 2795.53A' 'Mg 2 2802.71A' 'Fe 4 2829.36A' 'Fe 4 2835.74A'
 'Ar 4 2853.66A' 'Fe 4 3094.96A' 'He 1 3187.74A' 'Ne 5 3345.82A'
 'Ne 5 3425.88A' 'Fe 7 3586.32A' 'Fe 6 3662.50A' 'O 2 3726.03A'
 'O 2 3728.81A' 'H 1 3734.37A' 'H 1 3750.15A' 'Fe 7 3758.92A'
 'H 1 3770.63A' 'H 1 3797.90A' 'H 1 3835.38A' 'Ne 3 3868.76A'
 'He 1 3888.64A' 'H 1 3889.05A' 'Fe 5 3891.28A' 'Ne 3 3967.47A'
 'H 1 3970.07A' 'S 2 4068.60A' 'S 2 4076.35A' 'H 1 4101.73A'
 'Fe 2 4243.97A' 'Fe 2 4276.84A' 'Fe 2 4287.39A' 'Fe 2 4319.62A'
 'H 1 4340.46A' 'Fe 2 4346.86A' 'Fe 2 4352.79A' 'Fe 2 4358.37A'
 'Fe 2 4359.33A' 'O 3 4363.21A' 'Fe 2 4413.78A' 'Fe 2 4416.27A'
 'Fe 2 4452.10A' 'Fe 2 4474.90A' 'Fe 3 4658.05A' 'He 2 4685.68A'
 'Fe 2 4814.54A' 'H 1 4861.32A' 'Fe 2 4874.50A' 'Fe 2 4889.62A'
 'Fe 2 4905.35A' 'Fe 2 4923.92A' 'Fe 2 4947.39A' 'O 3 4958.91A'
 'Fe 2 4973.40A' 'Fe 3 4985.87A' 'Fe 2 5005.52A' 'O 3 5006.84A'
 'Fe 2 5018.44A' 'Fe 2 5020.25A' 'Fe 2 5049.30A' 'Fe 2 5072.41A'
 'Fe 2 5111.64A' 'Fe 2 5158.01A' 'Fe 2 5158.79A' 'Fe 2 5169.03A'
 'Fe 6 5176.04A' 'Fe 2 5184.80A' 'Fe 2 5261.63A' 'Fe 3 5270.40A'
 'Fe 2 5273.36A' 'Fe 2 5284.10A' 'Fe 2 5333.66A' 'Fe 2 5376.47A'
 'Fe 2 5412.67A' 'Fe 2 5433.15A' 'Fe 2 5527.36A' 'Fe 7 5720.71A'
 'He 1 5875.61A' 'He 1 5875.64A' 'Fe 7 6086.97A' 'O 1 6300.30A'
 'O 1 6363.78A' 'Fe 2 6516.08A' 'N 2 6548.05A' 'H 1 6562.80A'
 'N 2 6583.45A' 'Ni 2 6666.80A' 'He 1 6678.15A' 'S 2 6716.44A'
 'S 2 6730.82A' 'Ar 3 7135.79A' 'Fe 2 7155.17A' 'Fe 2 7172.00A'
 'Ca 2 7291.47A' 'Ca 2 7323.89A' 'Ni 2 7377.83A' 'Fe 2 7388.17A'
 'Ni 2 7411.61A' 'Fe 2 7452.56A' 'Ar 3 7751.11A' 'O 1 8446.25A'
 'O 1 8446.36A' 'O 1 8446.76A' 'Cl 2 8578.70A' 'Fe 2 8616.95A'
 'Fe 2 8891.93A' 'Fe 2 9051.95A' 'S 3 9068.62A' 'Fe 2 9226.63A'
 'H 1 9229.02A' 'Fe 2 9267.56A' 'Fe 2 9399.04A' 'Fe 2 9470.94A'
 'S 3 9530.62A' 'H 1 9545.97A' 'H 1 1.00494m' 'S 2 1.02867m'
 'S 2 1.03205m' 'S 2 1.03364m' 'He 1 1.08291m' 'He 1 1.08303m'
 'H 1 1.09381m' 'O 1 1.12863m' 'O 1 1.12864m' 'O 1 1.12869m'
 'O 1 1.12870m' 'O 1 1.12873m' 'Ni 2 1.19102m' 'Fe 2 1.25668m'
 'Fe 2 1.27877m' 'H 1 1.28181m' 'Fe 2 1.29427m' 'Fe 2 1.32055m'
 'Fe 2 1.32777m' 'Fe 2 1.37181m' 'Fe 2 1.53348m' 'Fe 2 1.59948m'
 'Fe 2 1.64355m' 'Fe 2 1.66377m' 'Fe 2 1.67688m' 'Fe 2 1.71113m'
 'Fe 2 1.74494m' 'Fe 2 1.79711m' 'Fe 2 1.80002m' 'Fe 2 1.80940m'
 'H 1 1.87510m' 'Fe 2 1.89541m' 'Ni 2 1.93877m' 'Fe 2 1.95361m'
 'Si 6 1.96247m' 'H 1 2.16553m' 'Si 7 2.48071m']

This is also reported if we give use the print function on a grid directly:

[4]:
print(grid)
+--------------------------------------------------------------------------------+
|                                      GRID                                      |
+-----------------------------+--------------------------------------------------+
| Attribute                   | Value                                            |
+-----------------------------+--------------------------------------------------+
| grid_dir                    | '../../../tests/test_grid'                       |
+-----------------------------+--------------------------------------------------+
| grid_name                   | 'test_grid'                                      |
+-----------------------------+--------------------------------------------------+
| grid_ext                    | 'hdf5'                                           |
+-----------------------------+--------------------------------------------------+
| grid_filename               | '../../../tests/test_grid/test_grid.hdf5'        |
+-----------------------------+--------------------------------------------------+
| reprocessed                 | True                                             |
+-----------------------------+--------------------------------------------------+
| lines_available             | True                                             |
+-----------------------------+--------------------------------------------------+
| naxes                       | 2                                                |
+-----------------------------+--------------------------------------------------+
| date_created                | '2025-03-05'                                     |
+-----------------------------+--------------------------------------------------+
| synthesizer_grids_version   | '0.1.dev613+ga9a6aa9'                            |
+-----------------------------+--------------------------------------------------+
| synthesizer_version         | '0.8.5b1.dev124+ge16216b5'                       |
+-----------------------------+--------------------------------------------------+
| has_lines                   | True                                             |
+-----------------------------+--------------------------------------------------+
| has_spectra                 | True                                             |
+-----------------------------+--------------------------------------------------+
| lines_available             | True                                             |
+-----------------------------+--------------------------------------------------+
| ndim                        | 3                                                |
+-----------------------------+--------------------------------------------------+
| new_line_format             | True                                             |
+-----------------------------+--------------------------------------------------+
| nlam                        | 9244                                             |
+-----------------------------+--------------------------------------------------+
| nlines                      | 215                                              |
+-----------------------------+--------------------------------------------------+
| reprocessed                 | True                                             |
+-----------------------------+--------------------------------------------------+
| shape                       | (51, 13, 9244)                                   |
+-----------------------------+--------------------------------------------------+
| available_spectra           | [incident, linecont, nebular, transmitted,       |
|                             |  total, nebular_continuum]                       |
+-----------------------------+--------------------------------------------------+
| axes                        | [ages, metallicities]                            |
+-----------------------------+--------------------------------------------------+
| available_lines (215,)      | [He 2 1025.27A, O 6 1031.91A, O 6 1037.61A, ...] |
+-----------------------------+--------------------------------------------------+
| line_lams (215,)            | 1.03e+03 Å -> 2.48e+04 Å (Mean: 5.98e+03 Å)      |
+-----------------------------+--------------------------------------------------+
| incident_axes               | ['ages' 'metallicities']                         |
+-----------------------------+--------------------------------------------------+
| spec_names (4,)             | [incident, transmitted, nebular, ...]            |
+-----------------------------+--------------------------------------------------+
| lam (9244,)                 | 1.30e-04 Å -> 2.99e+11 Å (Mean: 9.73e+09 Å)      |
+-----------------------------+--------------------------------------------------+
| line_ids (215,)             | [He 2 1025.27A, O 6 1031.91A, O 6 1037.61A, ...] |
+-----------------------------+--------------------------------------------------+
| spectra                     | incident: ndarray                                |
|                             | linecont: ndarray                                |
|                             | nebular: ndarray                                 |
|                             | transmitted: ndarray                             |
|                             | total: ndarray                                   |
|                             | nebular_continuum: ndarray                       |
+-----------------------------+--------------------------------------------------+
| line_lums                   | nebular: unyt_array                              |
|                             | linecont: unyt_array                             |
|                             | nebular_continuum: unyt_array                    |
|                             | transmitted: unyt_array                          |
|                             | incident: unyt_array                             |
|                             | total: unyt_array                                |
+-----------------------------+--------------------------------------------------+
| line_conts                  | nebular: unyt_array                              |
|                             | linecont: unyt_array                             |
|                             | nebular_continuum: unyt_array                    |
|                             | transmitted: unyt_array                          |
|                             | incident: unyt_array                             |
|                             | total: unyt_array                                |
+-----------------------------+--------------------------------------------------+
| log10_specific_ionising_lum | HI: ndarray                                      |
|                             | HeII: ndarray                                    |
+-----------------------------+--------------------------------------------------+

Extracting lines from a Grid

To demonstrate, we choose some age and metallicity and extract the spectra at that grid point. We can then get information on a single line, in this case H-\(\beta\).

[5]:
log10age = 6.0  # log10(age/yr)
metallicity = 0.01

# find nearest grid point
grid_point = grid.get_grid_point(log10ages=log10age, metallicity=metallicity)
print(grid_point)
line = grid.get_lines(grid_point, "H 1 6562.80A")
print(line)
(np.int64(0), np.int64(8))
+--------------------------------------------------+
|                  LINECOLLECTION                  |
+--------------------+-----------------------------+
| Attribute          | Value                       |
+--------------------+-----------------------------+
| nlines             | 1                           |
+--------------------+-----------------------------+
| id                 | 'H 1 6562.80A'              |
+--------------------+-----------------------------+
| ndim               | 1                           |
+--------------------+-----------------------------+
| nlam               | 1                           |
+--------------------+-----------------------------+
| shape              | (1,)                        |
+--------------------+-----------------------------+
| elements           | [H, ]                       |
+--------------------+-----------------------------+
| line_ids           | ['H 1 6562.80A']            |
+--------------------+-----------------------------+
| lam                | [6562.8] Å                  |
+--------------------+-----------------------------+
| luminosity         | [9.865937e+34] erg/s        |
+--------------------+-----------------------------+
| continuum          | [3.10475356e+20] erg/(Hz*s) |
+--------------------+-----------------------------+
| cont               | [3.10475356e+20] erg/(Hz*s) |
+--------------------+-----------------------------+
| continuum_llam     | [2.1610733e+31] erg/(s*Å)   |
+--------------------+-----------------------------+
| energy             | [1.88919658] eV             |
+--------------------+-----------------------------+
| equivalent_width   | [4565.29492945] Å           |
+--------------------+-----------------------------+
| lum                | [9.865937e+34] erg/s        |
+--------------------+-----------------------------+
| nu                 | [4.5680572e+14] Hz          |
+--------------------+-----------------------------+
| vacuum_wavelengths | [6564.61289406] Å           |
+--------------------+-----------------------------+

We can do this for a combination of lines (e.g. a doublet) if we just pass a comma-separated list of lines ids to the line_id argument.

[6]:
line = grid.get_lines(grid_point, ", ".join([Hb, O3r, O3b]))
print(line)
+-------------------------------------------------------------------+
|                          LINECOLLECTION                           |
+--------------------+----------------------------------------------+
| Attribute          | Value                                        |
+--------------------+----------------------------------------------+
| nlines             | 1                                            |
+--------------------+----------------------------------------------+
| id                 | 'H 1 4861.32A, O 3 5006.84A, O 3 4958.91A'   |
+--------------------+----------------------------------------------+
| ndim               | 1                                            |
+--------------------+----------------------------------------------+
| nlam               | 1                                            |
+--------------------+----------------------------------------------+
| shape              | (1,)                                         |
+--------------------+----------------------------------------------+
| elements           | [H, O, O]                                    |
+--------------------+----------------------------------------------+
| line_ids           | ['H 1 4861.32A, O 3 5006.84A, O 3 4958.91A'] |
+--------------------+----------------------------------------------+
| lam                | [4942.35666667] Å                            |
+--------------------+----------------------------------------------+
| luminosity         | [2.57937645e+35] erg/s                       |
+--------------------+----------------------------------------------+
| continuum          | [6.09969668e+20] erg/(Hz*s)                  |
+--------------------+----------------------------------------------+
| cont               | [6.09969668e+20] erg/(Hz*s)                  |
+--------------------+----------------------------------------------+
| continuum_llam     | [7.48618881e+31] erg/(s*Å)                   |
+--------------------+----------------------------------------------+
| energy             | [2.50860473] eV                              |
+--------------------+----------------------------------------------+
| equivalent_width   | [3445.51348233] Å                            |
+--------------------+----------------------------------------------+
| lum                | [2.57937645e+35] erg/s                       |
+--------------------+----------------------------------------------+
| nu                 | [6.06577951e+14] Hz                          |
+--------------------+----------------------------------------------+
| vacuum_wavelengths | [4943.73617102] Å                            |
+--------------------+----------------------------------------------+

We can also get a collection of individual lines by passing a list of line ids to the line_id argument.

[7]:
line = grid.get_lines(grid_point, [Hb, O3r, O3b])
print(line)
+--------------------------------------------------------------------------------+
|                                 LINECOLLECTION                                 |
+--------------------+-----------------------------------------------------------+
| Attribute          | Value                                                     |
+--------------------+-----------------------------------------------------------+
| nlines             | 3                                                         |
+--------------------+-----------------------------------------------------------+
| ndim               | 1                                                         |
+--------------------+-----------------------------------------------------------+
| nlam               | 3                                                         |
+--------------------+-----------------------------------------------------------+
| shape              | (3,)                                                      |
+--------------------+-----------------------------------------------------------+
| available_ratios   | [R3, ]                                                    |
+--------------------+-----------------------------------------------------------+
| elements           | [H, O, O]                                                 |
+--------------------+-----------------------------------------------------------+
| line_ids           | ['H 1 4861.32A' 'O 3 5006.84A' 'O 3 4958.91A']            |
+--------------------+-----------------------------------------------------------+
| lam                | [4861.32 5006.84 4958.91] Å                               |
+--------------------+-----------------------------------------------------------+
| luminosity         | [3.36671057e+34 1.68041462e+35 5.62290773e+34] erg/s      |
+--------------------+-----------------------------------------------------------+
| continuum          | [1.99786695e+20 2.06153294e+20 2.04029679e+20] erg/(Hz*s) |
+--------------------+-----------------------------------------------------------+
| cont               | [1.99786695e+20 2.06153294e+20 2.04029679e+20] erg/(Hz*s) |
+--------------------+-----------------------------------------------------------+
| continuum_llam     | [2.53442151e+31 2.46537822e+31 2.48737690e+31] erg/(s*Å)  |
+--------------------+-----------------------------------------------------------+
| energy             | [2.55042238 2.47629629 2.50023076] eV                     |
+--------------------+-----------------------------------------------------------+
| equivalent_width   | [1328.39409279 6816.05201228 2260.57728803] Å             |
+--------------------+-----------------------------------------------------------+
| lum                | [3.36671057e+34 1.68041462e+35 5.62290773e+34] erg/s      |
+--------------------+-----------------------------------------------------------+
| nu                 | [6.16689414e+14 5.98765804e+14 6.04553134e+14] Hz         |
+--------------------+-----------------------------------------------------------+
| vacuum_wavelengths | [4862.6779924  5008.23663693 4960.29390118] Å             |
+--------------------+-----------------------------------------------------------+

If we don’t pass a list then it defaults to returning all available lines.

[8]:
lines = grid.get_lines(grid_point)
print(lines)
+-------------------------------------------------------------------------------------------------+
|                                         LINECOLLECTION                                          |
+---------------------------+---------------------------------------------------------------------+
| Attribute                 | Value                                                               |
+---------------------------+---------------------------------------------------------------------+
| nlines                    | 215                                                                 |
+---------------------------+---------------------------------------------------------------------+
| ndim                      | 1                                                                   |
+---------------------------+---------------------------------------------------------------------+
| nlam                      | 215                                                                 |
+---------------------------+---------------------------------------------------------------------+
| shape                     | (215,)                                                              |
+---------------------------+---------------------------------------------------------------------+
| available_ratios          | [BalmerDecrement, N2, S2, O1, R2, R3, R23,                          |
|                           |  O32, Ne3O2]                                                        |
+---------------------------+---------------------------------------------------------------------+
| available_diagrams        | [OHNO, BPT-NII, VO78-SII, VO78-OI]                                  |
+---------------------------+---------------------------------------------------------------------+
| elements                  | [He, O, O, He, Si, Si, He, H, O, N, N, Si,                          |
|                           |  Si, Si, O, O, O, C, C, C, Si, O, O, Si, O,                         |
|                           |  O, N, Si, Si, C, C, Ne, He, O, C, O, O, Al,                        |
|                           |  N, Mg, Si, Si, C, C, C, Si, O, C, C, Fe, Fe,                       |
|                           |  Fe, Fe, C, Fe, Fe, Fe, Fe, Fe, Fe, Mg, Fe,                         |
|                           |  Fe, Mg, Mg, Mg, Fe, Fe, Ar, Fe, He, Ne, Ne,                        |
|                           |  Fe, Fe, O, O, H, H, Fe, H, H, H, Ne, He, H,                        |
|                           |  Fe, Ne, H, S, S, H, Fe, Fe, Fe, Fe, H, Fe,                         |
|                           |  Fe, Fe, Fe, O, Fe, Fe, Fe, Fe, Fe, He, Fe,                         |
|                           |  H, Fe, Fe, Fe, Fe, Fe, O, Fe, Fe, Fe, O, Fe,                       |
|                           |  Fe, Fe, Fe, Fe, Fe, Fe, Fe, Fe, Fe, Fe, Fe,                        |
|                           |  Fe, Fe, Fe, Fe, Fe, Fe, Fe, Fe, He, He, Fe,                        |
|                           |  O, O, Fe, N, H, N, Ni, He, S, S, Ar, Fe, Fe,                       |
|                           |  Ca, Ca, Ni, Fe, Ni, Fe, Ar, O, O, O, Cl, Fe,                       |
|                           |  Fe, Fe, S, Fe, H, Fe, Fe, Fe, S, H, H, S,                          |
|                           |  S, S, He, He, H, O, O, O, O, O, Ni, Fe, Fe,                        |
|                           |  H, Fe, Fe, Fe, Fe, Fe, Fe, Fe, Fe, Fe, Fe,                         |
|                           |  Fe, Fe, Fe, Fe, H, Fe, Ni, Fe, Si, H, Si,]                         |
+---------------------------+---------------------------------------------------------------------+
| line_ids (215,)           | [He 2 1025.27A, O 6 1031.91A, O 6 1037.61A, ...]                    |
+---------------------------+---------------------------------------------------------------------+
| lam (215,)                | 1.03e+03 Å -> 2.48e+04 Å (Mean: 5.98e+03 Å)                         |
+---------------------------+---------------------------------------------------------------------+
| luminosity (215,)         | 0.00e+00 erg/s -> 1.99e+35 erg/s (Mean: 3.78e+33 erg/s)             |
+---------------------------+---------------------------------------------------------------------+
| continuum (215,)          | 2.10e+19 erg/(Hz*s) -> 9.64e+20 erg/(Hz*s) (Mean: 2.51e+20 erg)     |
+---------------------------+---------------------------------------------------------------------+
| cont (215,)               | 2.10e+19 erg/(Hz*s) -> 9.64e+20 erg/(Hz*s) (Mean: 2.51e+20 erg)     |
+---------------------------+---------------------------------------------------------------------+
| continuum_llam (215,)     | 1.19e+30 erg/(s*Å) -> 3.67e+32 erg/(s*Å) (Mean: 8.69e+31 erg/(s*Å)) |
+---------------------------+---------------------------------------------------------------------+
| energy (215,)             | 5.00e-01 eV -> 1.21e+01 eV (Mean: 3.76e+00 eV)                      |
+---------------------------+---------------------------------------------------------------------+
| equivalent_width (215,)   | 0.00e+00 Å -> 6.82e+03 Å (Mean: 2.02e+02 Å)                         |
+---------------------------+---------------------------------------------------------------------+
| lum (215,)                | 0.00e+00 erg/s -> 1.99e+35 erg/s (Mean: 3.78e+33 erg/s)             |
+---------------------------+---------------------------------------------------------------------+
| nu (215,)                 | 1.21e+14 Hz -> 2.92e+15 Hz (Mean: 9.09e+14 Hz)                      |
+---------------------------+---------------------------------------------------------------------+
| vacuum_wavelengths (215,) | 1.03e+03 Å -> 2.48e+04 Å (Mean: 5.98e+03 Å)                         |
+---------------------------+---------------------------------------------------------------------+

Ratios as a function of metallicity

To show the dependence on stellar metallicity we can loop over the metallicity grid:

[9]:
ratio_id = "R23"
ia = 0  # 1 Myr old for test grid
ratios = []
for iZ, Z in enumerate(grid.metallicity):
    grid_point = (ia, iZ)
    lines = grid.get_lines(grid_point)
    ratios.append(lines.get_ratio(ratio_id))

Zsun = grid.metallicity / 0.0124
plt.plot(Zsun, ratios)
plt.xlim([0.01, 1])
plt.ylim([1, 20])
plt.xscale("log")
plt.yscale("log")
plt.xlabel(r"$Z/Z_{\odot}$")
plt.ylabel(rf"{ratio_id}")
plt.show()
../_images/lines_grid_lines_17_0.png

Line Diagrams as a function of metallicity

We can also generate diagrams using pairs of line ratios, such as the famous Baldwin, Phillips & Terlevich (BPT) diagram.

line_ratios also contains some classification regions (e.g. Kewley+13 and Kauffmann+03) that we can plot:

[10]:
diagram_id = "BPT-NII"
ia = 0  # 1 Myr old for test grid
x = []
y = []
for iZ, Z in enumerate(grid.metallicity):
    grid_point = (ia, iZ)
    lines = grid.get_lines(grid_point)
    x_, y_ = lines.get_diagram(diagram_id)
    x.append(x_)
    y.append(y_)


# Plot the Kewley SF/AGN dividing line
fig, ax = plt.subplots()
ax.plot(x, y)
logNII_Ha = np.arange(-2.0, 1.0, 0.01)
logOIII_Hb = line_ratios.plot_bpt_kewley01(
    logNII_Ha, fig=fig, ax=ax, show=True, c="k", lw="2", alpha=0.3
)
/home/runner/work/synthesizer/synthesizer/src/synthesizer/emissions/line_ratios.py:178: RuntimeWarning: overflow encountered in power
  ax.loglog(10**logNII_Ha, 10**logOIII_Hb, **kwargs)
../_images/lines_grid_lines_19_1.png