Skip to content

Instantly share code, notes, and snippets.

@mlforcada
Last active June 16, 2025 21:14
Show Gist options
  • Select an option

  • Save mlforcada/f86ca9e2e27c97398d658c398501c956 to your computer and use it in GitHub Desktop.

Select an option

Save mlforcada/f86ca9e2e27c97398d658c398501c956 to your computer and use it in GitHub Desktop.
pynomo nomograph for line of sight
"""
ex_type1_nomo_1.py
Simple nomogram of type 1: F1 + F2 + F3 = 0
Copyright (C) 2007-2009 Leif Roschier
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import sys
sys.path.insert(0, "..")
# sys.path[:0] = [".."]
from pynomo.nomographer import Nomographer
import numpy as np
R=6370000
N_params_1 = {
'u_min': 0.0,
'u_max': 4000.0,
'function': lambda u: np.sqrt(2*u*R+u*u),
'title': r'$h_1$ (m)',
'tick_levels': 4,
'tick_text_levels': 2,
}
N_params_2 = {
'u_min': 0.0,
'u_max': 450.0,
'function': lambda u: -1000.0*u,
'title': r'$D$ (km)',
'tick_levels': 4,
'tick_text_levels': 2,
}
N_params_3 = {
'u_min': 4000.0,
'u_max': 0.0,
'function': lambda u: np.sqrt(2*u*R+u*u),
'title': r'$h_2$ (m)',
'tick_levels': 4,
'tick_text_levels': 2,
}
block_1_params = {
'block_type': 'type_1',
'width': 10,
'height': 10,
'f1_params': N_params_1,
'f2_params': N_params_2,
'f3_params': N_params_3,
# 'isopleth_values': [[6, 2, 'x']],
}
main_params = {
'filename': 'test.pdf',
'paper_height': 10,
'paper_width': 7,
'block_params': [block_1_params],
'transformations': [('rotate', 0.01), ],
'transformations': [('rotate', 0.01), ('scale paper',)],
# 'title_str': r'$\sqrt{2Rh_1+h_1^2}-D+\sqrt{2Rh_2+h_2^2}=0$',
'debug': False,
}
Nomographer(main_params)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment