File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -2041,25 +2041,26 @@ want different preferences:
20412041 25C 1. 00021MHz
20422042 75C 1. 00178MHz
20432043
2044- In this example, a subclass is created that is intended to report in
2044+ In the following example, a subclass is created that is intended to report in
20452045concentrations.
20462046
20472047.. code-block :: python
20482048
20492049 >> > class Concentration (Quantity ):
20502050 ... pass
2051+
20512052 >> > Concentration.set_prefs(
20522053 ... map_sf = dict (u = ' PPM' , n = ' PPB' , p = ' PPT' ),
20532054 ... show_label = True ,
20542055 ... )
20552056
2056- >> > pollutants = dict ( CO = 5 , SO2 = 20 , NO2 = 0.10 )
2057+ >> > pollutants = { ' CO ' : 5 , ' SO₂ ' : 20 , ' NO₂ ' : 0.10 }
20572058 >> > concentrations = [Concentration(v, scale = 1e-6 , name = k) for k, v in pollutants.items()]
20582059 >> > for each in concentrations:
20592060 ... print (each)
20602061 CO = 5 PPM
2061- SO2 = 20 PPM
2062- NO2 = 100 PPB
2062+ SO ₂ = 20 PPM
2063+ NO ₂ = 100 PPB
20632064
20642065 Alternately, you can simply set the preferences as attributes when creating the
20652066sublclasses. For example:
You can’t perform that action at this time.
0 commit comments