Difference between revisions of "Example:compound nomograph 1"
From Pynomo
(→Compound nomograph example 1) |
(→Source code of simple compound nomograph example) |
||
(11 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
In this example we construct compound nomograph of equation | In this example we construct compound nomograph of equation | ||
− | <math>\frac{A+B}{E}=\frac{F}{CD} \,</math> | + | <math>\frac{A+B}{E}=\frac{F}{CD}. \,</math> |
− | + | The equation is split into three equations that each are blocks: | |
− | <math>A+B=R_1 \,</math> | + | {| style="background:wihte; color:black" border="1" cellpadding="5" cellspacing="0" |
+ | |- | ||
+ | | <math>A+B=R_1 \,\,\,\,\,\,\,</math> || [[type 1]] | ||
+ | |- | ||
+ | | <math>CD=R_2 \,\,\,\,\,\,\,</math> || [[type 2]] | ||
+ | |- | ||
+ | | <math>\frac{R_1}{E}= \frac{F}{R_2} \,\,\,\,\,\,\,</math> || [[type 4]] | ||
+ | |} | ||
− | |||
− | + | It is iterative process in practice with PyNomo to construct compound nomographs. | |
+ | One should generate nomographs and iteratively correct for example block mirroring and axis | ||
+ | tick sides, levels and title positions. The following is an example of final result after some | ||
+ | ten iterations. Note the 'tag' key that defines how blocks aling with respect to each other. | ||
+ | User has to take care that aligned scalings are really equal between blocks. Best practice | ||
+ | may be to print in early iterations the scalings and check they are equal. | ||
== Simple example == | == Simple example == | ||
{{Infobox_nomogram1 | {{Infobox_nomogram1 | ||
− | | name = | + | | name = Compound nomograph: example 1 |
− | | image = [[Image:Ex | + | | image = [[Image:Ex compound nomo 1.png|600px]] |
− | | file = [ | + | | file = [[Image:Ex compound nomo 1.pdf]] |
}} | }} | ||
− | ==== Source code of simple example | + | ==== Source code of simple compound nomograph example ==== |
<source lang=python> | <source lang=python> | ||
""" | """ | ||
− | + | ex_compound_nomo_1.py | |
− | + | Compound nomograph: (A+B)/E=F/(CD) | |
− | Copyright (C) 2007- | + | Copyright (C) 2007-2009 Leif Roschier |
This program is free software: you can redistribute it and/or modify | This program is free software: you can redistribute it and/or modify | ||
Line 40: | Line 51: | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
""" | """ | ||
− | from nomographer import * | + | from pynomo.nomographer import * |
− | + | # type 1 | |
+ | A_params={ | ||
'u_min':0.0, | 'u_min':0.0, | ||
'u_max':10.0, | 'u_max':10.0, | ||
'function':lambda u:u, | 'function':lambda u:u, | ||
− | 'title':r'$ | + | 'title':r'$A$', |
'tick_levels':2, | 'tick_levels':2, | ||
'tick_text_levels':1, | 'tick_text_levels':1, | ||
} | } | ||
− | + | B_params={ | |
'u_min':0.0, | 'u_min':0.0, | ||
'u_max':10.0, | 'u_max':10.0, | ||
'function':lambda u:u, | 'function':lambda u:u, | ||
− | 'title':r'$ | + | 'title':r'$B$', |
'tick_levels':2, | 'tick_levels':2, | ||
'tick_text_levels':1, | 'tick_text_levels':1, | ||
} | } | ||
− | + | R1a_params={ | |
'u_min':0.0, | 'u_min':0.0, | ||
− | 'u_max':-10.0, | + | 'u_max':10.0, |
+ | 'function':lambda u:-u, | ||
+ | 'title':'', | ||
+ | 'tick_levels':0, | ||
+ | 'tick_text_levels':0, | ||
+ | 'tag':'r1' | ||
+ | } | ||
+ | block_1_params={ | ||
+ | 'block_type':'type_1', | ||
+ | 'width':10.0, | ||
+ | 'height':10.0, | ||
+ | 'f1_params':A_params, | ||
+ | 'f2_params':B_params, | ||
+ | 'f3_params':R1a_params, | ||
+ | 'isopleth_values':[[1,7,'x']] | ||
+ | } | ||
+ | # type 4 | ||
+ | R1b_params={ | ||
+ | 'u_min':1.0, | ||
+ | 'u_max':10.0, | ||
'function':lambda u:u, | 'function':lambda u:u, | ||
− | 'title':r'$ | + | 'title':r'$R_1$', |
− | 'tick_levels': | + | 'tick_levels':0, |
+ | 'tick_text_levels':0, | ||
+ | 'tick_side':'right', | ||
+ | 'title_draw_center':True, | ||
+ | 'title_opposite_tick':False, | ||
+ | 'tag':'r1' | ||
+ | } | ||
+ | E_params={ | ||
+ | 'u_min':1.0, | ||
+ | 'u_max':10.0, | ||
+ | 'function':lambda u:u, | ||
+ | 'title':r'$E$', | ||
+ | 'tick_levels':3, | ||
'tick_text_levels':1, | 'tick_text_levels':1, | ||
+ | 'tick_side':'right', | ||
+ | 'title_draw_center':True, | ||
+ | 'title_opposite_tick':False, | ||
+ | } | ||
+ | F_params={ | ||
+ | 'u_min':1.0, | ||
+ | 'u_max':10.0, | ||
+ | 'function':lambda u:u, | ||
+ | 'title':r'$F$', | ||
+ | 'tick_levels':3, | ||
+ | 'tick_text_levels':1, | ||
+ | 'tick_side':'left', | ||
+ | 'title_draw_center':True, | ||
+ | 'title_opposite_tick':True, | ||
+ | } | ||
+ | R2a_params={ | ||
+ | 'u_min':1.0, | ||
+ | 'u_max':10.0, | ||
+ | 'function':lambda u:u, | ||
+ | 'title':r'$R_2$', | ||
+ | 'tick_levels':0, | ||
+ | 'tick_text_levels':0, | ||
+ | 'tick_side':'left', | ||
+ | 'title_draw_center':True, | ||
+ | 'title_opposite_tick':False, | ||
+ | 'tag':'r2' | ||
} | } | ||
+ | block_2_params={ | ||
+ | 'block_type':'type_4', | ||
+ | 'f1_params':R1b_params, | ||
+ | 'f2_params':E_params, | ||
+ | 'f3_params':F_params, | ||
+ | 'f4_params':R2a_params, | ||
+ | 'mirror_x':True, | ||
+ | 'isopleth_values':[['x',9,4,'x']] | ||
+ | } | ||
+ | # type 2 N | ||
+ | R2b_params={ | ||
+ | 'u_min':0.0, | ||
+ | 'u_max':10.0, | ||
+ | 'function':lambda u:u, | ||
+ | 'title':r'$$', | ||
+ | 'tick_levels':0, | ||
+ | 'tick_text_levels':0, | ||
+ | 'tag':'r2' | ||
+ | } | ||
− | + | C_params={ | |
− | 'block_type':' | + | 'u_min':0.5, |
+ | 'u_max':5.0, | ||
+ | 'function':lambda u:u, | ||
+ | 'title':r'$C$', | ||
+ | 'tick_levels':3, | ||
+ | 'tick_text_levels':1, | ||
+ | 'tick_side':'left', | ||
+ | 'scale_type':'linear smart', | ||
+ | } | ||
+ | |||
+ | D_params={ | ||
+ | 'u_min':1.0, | ||
+ | 'u_max':10.0, | ||
+ | 'function':lambda u:u, | ||
+ | 'title':r'$D$', | ||
+ | 'tick_levels':3, | ||
+ | 'tick_text_levels':1, | ||
+ | } | ||
+ | |||
+ | block_3_params={ | ||
+ | 'block_type':'type_2', | ||
'width':10.0, | 'width':10.0, | ||
'height':10.0, | 'height':10.0, | ||
− | 'f1_params': | + | 'f1_params':R2b_params, |
− | 'f2_params': | + | 'f2_params':C_params, |
− | 'f3_params': | + | 'f3_params':D_params, |
+ | 'mirror_y':True, | ||
+ | 'isopleth_values':[['x',1,'x']] | ||
} | } | ||
main_params={ | main_params={ | ||
− | 'filename':' | + | 'filename':'ex_compound_nomo_1.pdf', |
'paper_height':10.0, | 'paper_height':10.0, | ||
'paper_width':10.0, | 'paper_width':10.0, | ||
− | 'block_params':[block_1_params], | + | 'block_params':[block_1_params,block_2_params,block_3_params], |
'transformations':[('rotate',0.01),('scale paper',)], | 'transformations':[('rotate',0.01),('scale paper',)], | ||
− | |||
} | } | ||
Nomographer(main_params) | Nomographer(main_params) | ||
− | |||
− | |||
− | |||
− | + | </source> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |
Latest revision as of 19:12, 21 October 2009
Compound nomograph example 1
In this example we construct compound nomograph of equation
[math]\frac{A+B}{E}=\frac{F}{CD}. \,[/math]
The equation is split into three equations that each are blocks:
[math]A+B=R_1 \,\,\,\,\,\,\,[/math] | type 1 |
[math]CD=R_2 \,\,\,\,\,\,\,[/math] | type 2 |
[math]\frac{R_1}{E}= \frac{F}{R_2} \,\,\,\,\,\,\,[/math] | type 4 |
It is iterative process in practice with PyNomo to construct compound nomographs.
One should generate nomographs and iteratively correct for example block mirroring and axis
tick sides, levels and title positions. The following is an example of final result after some
ten iterations. Note the 'tag' key that defines how blocks aling with respect to each other.
User has to take care that aligned scalings are really equal between blocks. Best practice
may be to print in early iterations the scalings and check they are equal.
Simple example
Compound nomograph: example 1 | |
---|---|
![]() |
|
Generated portable document file (pdf): | File:Ex compound nomo 1.pdf |
Source code of simple compound nomograph example
""" ex_compound_nomo_1.py Compound nomograph: (A+B)/E=F/(CD) 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/>. """ from pynomo.nomographer import * # type 1 A_params={ 'u_min':0.0, 'u_max':10.0, 'function':lambda u:u, 'title':r'$A$', 'tick_levels':2, 'tick_text_levels':1, } B_params={ 'u_min':0.0, 'u_max':10.0, 'function':lambda u:u, 'title':r'$B$', 'tick_levels':2, 'tick_text_levels':1, } R1a_params={ 'u_min':0.0, 'u_max':10.0, 'function':lambda u:-u, 'title':'', 'tick_levels':0, 'tick_text_levels':0, 'tag':'r1' } block_1_params={ 'block_type':'type_1', 'width':10.0, 'height':10.0, 'f1_params':A_params, 'f2_params':B_params, 'f3_params':R1a_params, 'isopleth_values':[[1,7,'x']] } # type 4 R1b_params={ 'u_min':1.0, 'u_max':10.0, 'function':lambda u:u, 'title':r'$R_1$', 'tick_levels':0, 'tick_text_levels':0, 'tick_side':'right', 'title_draw_center':True, 'title_opposite_tick':False, 'tag':'r1' } E_params={ 'u_min':1.0, 'u_max':10.0, 'function':lambda u:u, 'title':r'$E$', 'tick_levels':3, 'tick_text_levels':1, 'tick_side':'right', 'title_draw_center':True, 'title_opposite_tick':False, } F_params={ 'u_min':1.0, 'u_max':10.0, 'function':lambda u:u, 'title':r'$F$', 'tick_levels':3, 'tick_text_levels':1, 'tick_side':'left', 'title_draw_center':True, 'title_opposite_tick':True, } R2a_params={ 'u_min':1.0, 'u_max':10.0, 'function':lambda u:u, 'title':r'$R_2$', 'tick_levels':0, 'tick_text_levels':0, 'tick_side':'left', 'title_draw_center':True, 'title_opposite_tick':False, 'tag':'r2' } block_2_params={ 'block_type':'type_4', 'f1_params':R1b_params, 'f2_params':E_params, 'f3_params':F_params, 'f4_params':R2a_params, 'mirror_x':True, 'isopleth_values':[['x',9,4,'x']] } # type 2 N R2b_params={ 'u_min':0.0, 'u_max':10.0, 'function':lambda u:u, 'title':r'$$', 'tick_levels':0, 'tick_text_levels':0, 'tag':'r2' } C_params={ 'u_min':0.5, 'u_max':5.0, 'function':lambda u:u, 'title':r'$C$', 'tick_levels':3, 'tick_text_levels':1, 'tick_side':'left', 'scale_type':'linear smart', } D_params={ 'u_min':1.0, 'u_max':10.0, 'function':lambda u:u, 'title':r'$D$', 'tick_levels':3, 'tick_text_levels':1, } block_3_params={ 'block_type':'type_2', 'width':10.0, 'height':10.0, 'f1_params':R2b_params, 'f2_params':C_params, 'f3_params':D_params, 'mirror_y':True, 'isopleth_values':[['x',1,'x']] } main_params={ 'filename':'ex_compound_nomo_1.pdf', 'paper_height':10.0, 'paper_width':10.0, 'block_params':[block_1_params,block_2_params,block_3_params], 'transformations':[('rotate',0.01),('scale paper',)], } Nomographer(main_params)