Difference between revisions of "Example:compound nomograph 1"

From Pynomo
Jump to: navigation, search
(Parameters for type 1)
(Source code of simple compound nomograph example)
 
(6 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>
  
just as an example. The equation is split into three equations that each are blocks:
+
The equation is split into three equations that each are blocks:
  
<math>A+B=R_1 \,\,\,\,\,\,\,</math> ([[type 1]])
+
{| 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]]
 +
|}
  
<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
It is iterative process in practice with PyNomo to construct compound nomograps.  
+
tick sides, levels and title positions. The following is an example of final result after some  
One should generate nomographs and correct for example block mirroring and axis
+
tick sides, levels and title positions. The following is an example of result after some  
+
 
ten iterations. Note the 'tag' key that defines how blocks aling with respect to each other.
 
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
 
User has to take care that aligned scalings are really equal between blocks. Best practice
Line 21: Line 25:
 
== Simple example ==
 
== Simple example ==
 
{{Infobox_nomogram1
 
{{Infobox_nomogram1
| name        = Simple example: Type 1  
+
| name        = Compound nomograph: example 1  
| image =  [[Image:Ex type1 nomo 1.png|600px]]
+
| image =  [[Image:Ex compound nomo 1.png|600px]]
| file = [http://nomography.org/wiki/images/a/ac/Ex_type1_nomo_1.pdf Ex_type1_nomo_1.pdf]
+
| file = [[Image:Ex compound nomo 1.pdf]]
 
}}
 
}}
 
==== Source code of simple compound nomograph example ====
 
==== Source code of simple compound nomograph example ====
Line 32: Line 36:
 
     Compound nomograph: (A+B)/E=F/(CD)
 
     Compound nomograph: (A+B)/E=F/(CD)
  
     Copyright (C) 2007-2008 Leif Roschier
+
     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 47: 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
 
# type 1
Line 84: Line 88:
 
             'f2_params':B_params,
 
             'f2_params':B_params,
 
             'f3_params':R1a_params,
 
             'f3_params':R1a_params,
 +
            'isopleth_values':[[1,7,'x']]
 
             }
 
             }
 
# type 4
 
# type 4
Line 139: Line 144:
 
                 'f3_params':F_params,
 
                 'f3_params':F_params,
 
                 'f4_params':R2a_params,
 
                 'f4_params':R2a_params,
                 'mirror_x':True
+
                 'mirror_x':True,
 +
                'isopleth_values':[['x',9,4,'x']]
 
                             }
 
                             }
 
# type 2 N
 
# type 2 N
Line 160: Line 166:
 
         'tick_text_levels':1,
 
         'tick_text_levels':1,
 
         'tick_side':'left',
 
         'tick_side':'left',
 +
        'scale_type':'linear smart',
 
                 }
 
                 }
  
Line 178: Line 185:
 
             'f2_params':C_params,
 
             'f2_params':C_params,
 
             'f3_params':D_params,
 
             'f3_params':D_params,
             'mirror_y':True
+
             'mirror_y':True,
 +
            'isopleth_values':[['x',1,'x']]
 
             }
 
             }
  
Line 189: Line 197:
 
               }
 
               }
 
Nomographer(main_params)
 
Nomographer(main_params)
 +
  
 
</source>
 
</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
Ex compound nomo 1.png
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)