Skip to content

Commit 3cbe091

Browse files
Merge pull request #144 from robbievanleeuwen/feature/print-results-scaling
Improved number formatting
2 parents b0b1185 + 7075202 commit 3cbe091

24 files changed

+2117
-350
lines changed

docs/examples/area_properties.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"outputs": [],
133133
"source": [
134134
"gross_props = conc_sec.get_gross_properties()\n",
135-
"gross_props.print_results(fmt=\".3e\")"
135+
"gross_props.print_results()"
136136
]
137137
},
138138
{
@@ -153,7 +153,7 @@
153153
"outputs": [],
154154
"source": [
155155
"transformed_props = conc_sec.get_transformed_gross_properties(elastic_modulus=30.1e3)\n",
156-
"transformed_props.print_results(fmt=\".3e\")"
156+
"transformed_props.print_results()"
157157
]
158158
}
159159
],
@@ -173,7 +173,7 @@
173173
"name": "python",
174174
"nbconvert_exporter": "python",
175175
"pygments_lexer": "ipython3",
176-
"version": "3.11.4"
176+
"version": "3.12.7"
177177
}
178178
},
179179
"nbformat": 4,

docs/examples/as3600.ipynb

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
" RectangularStressBlock,\n",
2828
")\n",
2929
"from concreteproperties.design_codes import AS3600\n",
30-
"from concreteproperties.results import MomentInteractionResults"
30+
"from concreteproperties.post import si_kn_m, si_n_mm\n",
31+
"from concreteproperties.results import BiaxialBendingResults, MomentInteractionResults"
3132
]
3233
},
3334
{
@@ -68,8 +69,12 @@
6869
"source": [
6970
"print(concrete.name)\n",
7071
"print(f\"Density = {concrete.density} kg/mm^3\")\n",
71-
"concrete.stress_strain_profile.plot_stress_strain(title=\"Service Profile\")\n",
72-
"concrete.ultimate_stress_strain_profile.plot_stress_strain(title=\"Ultimate Profile\")\n",
72+
"concrete.stress_strain_profile.plot_stress_strain(\n",
73+
" title=\"Service Profile\", eng=True, units=si_n_mm\n",
74+
")\n",
75+
"concrete.ultimate_stress_strain_profile.plot_stress_strain(\n",
76+
" title=\"Ultimate Profile\", eng=True, units=si_n_mm\n",
77+
")\n",
7378
"print(\n",
7479
" f\"Concrete Flexural Tensile Strength: {concrete.flexural_tensile_strength:.2f} MPa\"\n",
7580
")"
@@ -92,7 +97,7 @@
9297
"source": [
9398
"print(steel.name)\n",
9499
"print(f\"Density = {steel.density} kg/mm^3\")\n",
95-
"steel.stress_strain_profile.plot_stress_strain()"
100+
"steel.stress_strain_profile.plot_stress_strain(eng=True, units=si_n_mm)"
96101
]
97102
},
98103
{
@@ -240,7 +245,10 @@
240245
"outputs": [],
241246
"source": [
242247
"MomentInteractionResults.plot_multiple_diagrams(\n",
243-
" [f_mi_res, mi_res], [\"Factored\", \"Unfactored\"], fmt=\"-\"\n",
248+
" [mi_res, f_mi_res],\n",
249+
" [\"Unfactored\", \"Factored\"],\n",
250+
" fmt=\"-\",\n",
251+
" units=si_kn_m,\n",
244252
")"
245253
]
246254
},
@@ -294,7 +302,11 @@
294302
"n_cases = len(n_stars)\n",
295303
"\n",
296304
"# plot moment interaction diagram\n",
297-
"ax = f_mi_res.plot_diagram(fmt=\"k-\", render=False)\n",
305+
"ax = f_mi_res.plot_diagram(\n",
306+
" fmt=\"k-\",\n",
307+
" units=si_kn_m,\n",
308+
" render=False,\n",
309+
")\n",
298310
"\n",
299311
"# check to see if combination is within diagram and plot result\n",
300312
"for idx in range(n_cases):\n",
@@ -356,6 +368,7 @@
356368
" [f_mi_res, f_mi_res_bil, f_mi_res_par],\n",
357369
" [\"Rectangular\", \"Bilinear\", \"Parabolic\"],\n",
358370
" fmt=\"-\",\n",
371+
" units=si_kn_m,\n",
359372
")"
360373
]
361374
},
@@ -400,15 +413,19 @@
400413
"outputs": [],
401414
"source": [
402415
"# plot case 1\n",
403-
"ax = f_bb_res1.plot_diagram(fmt=\"x-\", render=False)\n",
404-
"bb_res1.plot_diagram(fmt=\"o-\", ax=ax)\n",
405-
"plt.show()\n",
416+
"BiaxialBendingResults.plot_multiple_diagrams_2d(\n",
417+
" [bb_res1, f_bb_res1],\n",
418+
" labels=[\"Unfactored\", \"Factored\"],\n",
419+
" units=si_kn_m,\n",
420+
")\n",
406421
"print(f\"Average phi = {np.mean(phis1):.3f}\")\n",
407422
"\n",
408423
"# plot case 2\n",
409-
"ax = f_bb_res2.plot_diagram(fmt=\"x-\", render=False)\n",
410-
"bb_res2.plot_diagram(fmt=\"o-\", ax=ax)\n",
411-
"plt.show()\n",
424+
"BiaxialBendingResults.plot_multiple_diagrams_2d(\n",
425+
" [bb_res2, f_bb_res2],\n",
426+
" labels=[\"Unfactored\", \"Factored\"],\n",
427+
" units=si_kn_m,\n",
428+
")\n",
412429
"print(f\"Average phi = {np.mean(phis2):.3f}\")"
413430
]
414431
},
@@ -437,7 +454,7 @@
437454
"name": "python",
438455
"nbconvert_exporter": "python",
439456
"pygments_lexer": "ipython3",
440-
"version": "3.11.4"
457+
"version": "3.12.7"
441458
},
442459
"vscode": {
443460
"interpreter": {

docs/examples/biaxial_bending.ipynb

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
" SteelElasticPlastic,\n",
3636
" add_bar_rectangular_array,\n",
3737
")\n",
38+
"from concreteproperties.post import si_kn_m\n",
3839
"from concreteproperties.results import BiaxialBendingResults"
3940
]
4041
},
@@ -149,7 +150,7 @@
149150
"metadata": {},
150151
"outputs": [],
151152
"source": [
152-
"bb_res.plot_diagram()"
153+
"bb_res.plot_diagram(eng=True, units=si_kn_m)"
153154
]
154155
},
155156
{
@@ -168,7 +169,7 @@
168169
"outputs": [],
169170
"source": [
170171
"bb_res = conc_sec.biaxial_bending_diagram(n=1000e3, n_points=24, progress_bar=False)\n",
171-
"bb_res.plot_diagram()"
172+
"bb_res.plot_diagram(eng=True, units=si_kn_m)"
172173
]
173174
},
174175
{
@@ -189,8 +190,8 @@
189190
"source": [
190191
"mi_x = conc_sec.moment_interaction_diagram(progress_bar=False)\n",
191192
"mi_y = conc_sec.moment_interaction_diagram(theta=np.pi / 2, progress_bar=False)\n",
192-
"mi_x.plot_diagram()\n",
193-
"mi_y.plot_diagram(moment=\"m_y\")\n",
193+
"mi_x.plot_diagram(eng=True)\n",
194+
"mi_y.plot_diagram(moment=\"m_y\", eng=True)\n",
194195
"print(f\"Decompression point for M_x is N = {mi_x.results[1].n / 1e3:.2f} kN\")\n",
195196
"print(f\"Decompression point for M_y is N = {mi_y.results[1].n / 1e3:.2f} kN\")"
196197
]
@@ -232,7 +233,11 @@
232233
"metadata": {},
233234
"outputs": [],
234235
"source": [
235-
"BiaxialBendingResults.plot_multiple_diagrams_3d(biaxial_results)"
236+
"BiaxialBendingResults.plot_multiple_diagrams_3d(\n",
237+
" biaxial_results,\n",
238+
" eng=True,\n",
239+
" units=si_kn_m,\n",
240+
")"
236241
]
237242
},
238243
{
@@ -250,7 +255,12 @@
250255
"metadata": {},
251256
"outputs": [],
252257
"source": [
253-
"BiaxialBendingResults.plot_multiple_diagrams_2d(biaxial_results, fmt=\"o-\")"
258+
"BiaxialBendingResults.plot_multiple_diagrams_2d(\n",
259+
" biaxial_results,\n",
260+
" fmt=\"o-\",\n",
261+
" eng=True,\n",
262+
" units=si_kn_m,\n",
263+
")"
254264
]
255265
},
256266
{
@@ -268,16 +278,14 @@
268278
"metadata": {},
269279
"outputs": [],
270280
"source": [
271-
"import matplotlib.pyplot as plt\n",
272-
"\n",
273-
"labels = [f\"N = {bb_res.n / 1e3:.0f} kN\" for bb_rs in biaxial_results[::2]]\n",
281+
"labels = [f\"N = {bb_res.n / 1e3:.0f} kN\" for bb_res in biaxial_results[::2]]\n",
274282
"\n",
275283
"ax = BiaxialBendingResults.plot_multiple_diagrams_2d(\n",
276-
" biaxial_results[::2], fmt=\"-\", labels=labels, render=False\n",
277-
")\n",
278-
"ax.set_xlabel(\"Bending Moment $M_x$ [kN.m]\")\n",
279-
"ax.set_ylabel(\"Bending Moment $M_y$ [kN.m]\")\n",
280-
"plt.show()"
284+
" biaxial_results[::2],\n",
285+
" fmt=\"-\",\n",
286+
" labels=labels,\n",
287+
" units=si_kn_m,\n",
288+
")"
281289
]
282290
}
283291
],

docs/examples/composite_section.ipynb

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
" SteelElasticPlastic,\n",
4343
" add_bar_circular_array,\n",
4444
" add_bar_rectangular_array,\n",
45-
")"
45+
")\n",
46+
"from concreteproperties.post import si_kn_m, si_n_mm"
4647
]
4748
},
4849
{
@@ -170,7 +171,7 @@
170171
"outputs": [],
171172
"source": [
172173
"el_stress = conc_sec.calculate_uncracked_stress(m_x=100e6)\n",
173-
"el_stress.plot_stress()"
174+
"el_stress.plot_stress(units=si_n_mm)"
174175
]
175176
},
176177
{
@@ -191,7 +192,7 @@
191192
"source": [
192193
"cr_res = conc_sec.calculate_cracked_properties()\n",
193194
"cr_stress = conc_sec.calculate_cracked_stress(cracked_results=cr_res, m=500e6)\n",
194-
"cr_stress.plot_stress()"
195+
"cr_stress.plot_stress(units=si_n_mm)"
195196
]
196197
},
197198
{
@@ -220,7 +221,7 @@
220221
"metadata": {},
221222
"outputs": [],
222223
"source": [
223-
"mk_res.plot_results(fmt=\"kx-\")"
224+
"mk_res.plot_results(fmt=\"kx-\", eng=True, units=si_kn_m)"
224225
]
225226
},
226227
{
@@ -237,7 +238,7 @@
237238
"serv_stress = conc_sec.calculate_service_stress(\n",
238239
" moment_curvature_results=mk_res, m=None, kappa=2e-5\n",
239240
")\n",
240-
"serv_stress.plot_stress()"
241+
"serv_stress.plot_stress(units=si_n_mm)"
241242
]
242243
},
243244
{
@@ -258,8 +259,8 @@
258259
"source": [
259260
"ult_res_x = conc_sec.ultimate_bending_capacity()\n",
260261
"ult_res_y = conc_sec.ultimate_bending_capacity(theta=np.pi / 2)\n",
261-
"ult_res_x.print_results()\n",
262-
"ult_res_y.print_results()"
262+
"ult_res_x.print_results(units=si_kn_m)\n",
263+
"ult_res_y.print_results(units=si_kn_m)"
263264
]
264265
},
265266
{
@@ -270,7 +271,7 @@
270271
"outputs": [],
271272
"source": [
272273
"mi_res = conc_sec.moment_interaction_diagram(progress_bar=False)\n",
273-
"mi_res.plot_diagram()"
274+
"mi_res.plot_diagram(units=si_kn_m)"
274275
]
275276
},
276277
{
@@ -281,7 +282,7 @@
281282
"outputs": [],
282283
"source": [
283284
"bb_res = conc_sec.biaxial_bending_diagram(n_points=24, progress_bar=False)\n",
284-
"bb_res.plot_diagram()"
285+
"bb_res.plot_diagram(units=si_kn_m)"
285286
]
286287
},
287288
{
@@ -293,8 +294,8 @@
293294
"source": [
294295
"ult_stress_x = conc_sec.calculate_ultimate_stress(ult_res_x)\n",
295296
"ult_stress_y = conc_sec.calculate_ultimate_stress(ult_res_y)\n",
296-
"ult_stress_x.plot_stress()\n",
297-
"ult_stress_y.plot_stress()"
297+
"ult_stress_x.plot_stress(units=si_n_mm)\n",
298+
"ult_stress_y.plot_stress(units=si_n_mm)"
298299
]
299300
},
300301
{
@@ -400,8 +401,8 @@
400401
"source": [
401402
"el_stress_comp = conc_sec_comp.calculate_uncracked_stress(m_x=10e6)\n",
402403
"el_stress_conc = conc_sec_conc.calculate_uncracked_stress(m_x=10e6)\n",
403-
"el_stress_comp.plot_stress()\n",
404-
"el_stress_conc.plot_stress()"
404+
"el_stress_comp.plot_stress(units=si_n_mm)\n",
405+
"el_stress_conc.plot_stress(units=si_n_mm)"
405406
]
406407
},
407408
{
@@ -428,8 +429,8 @@
428429
"cr_stress_conc = conc_sec_conc.calculate_cracked_stress(\n",
429430
" cracked_results=cr_res_conc, m=50e6\n",
430431
")\n",
431-
"cr_stress_comp.plot_stress()\n",
432-
"cr_stress_conc.plot_stress()"
432+
"cr_stress_comp.plot_stress(units=si_n_mm)\n",
433+
"cr_stress_conc.plot_stress(units=si_n_mm)"
433434
]
434435
},
435436
{
@@ -467,6 +468,8 @@
467468
" moment_curvature_results=[mk_res_comp, mk_res_conc],\n",
468469
" labels=[\"Composite\", \"Concrete\"],\n",
469470
" fmt=\"x-\",\n",
471+
" eng=True,\n",
472+
" units=si_kn_m,\n",
470473
")"
471474
]
472475
},
@@ -500,6 +503,7 @@
500503
" moment_interaction_results=[mi_res_comp, mi_res_conc],\n",
501504
" labels=[\"Composite\", \"Concrete\"],\n",
502505
" fmt=\"x-\",\n",
506+
" units=si_kn_m,\n",
503507
")"
504508
]
505509
},
@@ -632,7 +636,7 @@
632636
"metadata": {},
633637
"outputs": [],
634638
"source": [
635-
"mk_res.plot_results()"
639+
"mk_res.plot_results(eng=True, units=si_kn_m)"
636640
]
637641
},
638642
{
@@ -666,9 +670,9 @@
666670
"metadata": {},
667671
"outputs": [],
668672
"source": [
669-
"el_stress.plot_stress()\n",
670-
"yield_stress.plot_stress()\n",
671-
"ult_stress.plot_stress()"
673+
"el_stress.plot_stress(units=si_n_mm)\n",
674+
"yield_stress.plot_stress(units=si_n_mm)\n",
675+
"ult_stress.plot_stress(units=si_n_mm)"
672676
]
673677
},
674678
{
@@ -687,8 +691,8 @@
687691
"metadata": {},
688692
"outputs": [],
689693
"source": [
690-
"ult_res = conc_sec.ultimate_bending_capacity(theta=np.pi / 2)\n",
691-
"ult_res.print_results()"
694+
"ult_res = conc_sec.ultimate_bending_capacity()\n",
695+
"ult_res.print_results(units=si_kn_m)"
692696
]
693697
},
694698
{

0 commit comments

Comments
 (0)