Skip to content

"gas" planets with low boa pressure raise ValueError #8

@teald

Description

@teald

Summary

If the surface pressure is set to be < 1e7 Baryes, but gas is still set as the planetary type option, then a cryptic ValueError is produced.

I've fixed this in my version by changing host_functions.py line 679 to:

i_white_light_radius = max([0] + [i for i in range(quant.nlayer) if quant.p_lay[i] >= 1e7])

which ensures a while light radius is placed a the bottom of an atmosphere if there are no particularly high pressures. I'm not sure if this is the best way to solve it, but it seems to be working for me.

How to reproduce

python helios.py -boa_layer 1e6

Output

Traceback (most recent call last):
  File "/.../HELIOS_latest/helios.py", line 147, in <module>
    main()
  File "/.../HELIOS_latest/helios.py", line 145, in main
    run_helios()
  File "/.../HELIOS_latest/helios.py", line 85, in run_helios
    computer.radiation_loop(keeper, writer, reader, plotter)
  File "/.../HELIOS_latest/source/computation.py", line 877, in radiation_loop
    hsfunc.calculate_height_z(quant)
  File "/.../HELIOS_latest/source/host_functions.py", line 679, in calculate_height_z
    i_white_light_radius = max([i for i in range(quant.nlayer) if quant.p_lay[i] >= 1e7])
ValueError: max() arg is an empty sequence

Code of interest

i_white_light_radius = max([i for i in range(quant.nlayer) if quant.p_lay[i] >= 1e7])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions