You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a couple of proposals, and I've elected to split them between two discussions because they can be discussed and implemented separately. This is the first of two discussions.
I'd propose the addition of two additional features for Section.display_results(). I've implemented both of these for my own personal use by subclassing Section and creating my own display_results function, which is probably not a good idea for long-term use, but I didn't want to do a more elaborate implementation unless there's interest from others.
Ability to directly output to a file within the function. When I've used this package, it's been primarily to feed further analyses, and having an output file that can be stored with other computations as an appendix is useful. Assuming there's not an easy "Pythonic" way to pass the output table to a file that I'm missing (possible, I'm an indifferent programmer), I'd propose adding a new argument file= to Section.display_results() and post.print_results(). The end of post.print_results(file=f) can use the rich.print() function, which takes a file argument to print to file:
if file is not None:
rich.print(table, file=file)
This will enable this to be consistent with the print() function to create titles and headers when using the package:
with open(filename, 'w', encoding='utf-8') as f:
print(front_matter_str, file=f) # Printing front matter to the file explaining what was computed
section.display_results(file=f) # Proposed new usage to place results in file
The ability to add a column explaining the nomenclature. I find that the amount of data output makes it easy to lose track of precisely what each output item means, so having another column in the table that explains each item is helpful when reviewing results months to years later.
My solution iterates over a dict made from the SectionProperties comment block, and directly reads SectionProperties.<property>, rather than using the Section.get_<property>() functions like post.print_results() does so it needs a lot of work before it's ready for a PR, but the results that I propose look like this:
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Property ┃ Value ┃ Explanation ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ area │ 3.100790e+00 │ Cross-sectional area │
│ perimeter │ 1.862900e+01 │ Cross-sectional perimeter │
│ qx │ -3.504141e-15 │ First moment of area about the x-axis │
│ qy │ 1.538588e+00 │ First moment of area about the y-axis │
│ ixx_g │ 1.524298e+01 │ Second moment of area about the global │
│ │ │ x-axis │
│ iyy_g │ 1.612224e+00 │ Second moment of area about the global │
│ │ │ y-axis │
│ ixy_g │ -2.829822e-15 │ Second moment of area about the global │
│ │ │ xy-axis │
│ cx │ 4.961921e-01 │ X coordinate of the elastic centroid │
│ cy │ -1.130080e-15 │ Y coordinate of the elastic centroid │
Do these seem useful to others and worth further development?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I've got a couple of proposals, and I've elected to split them between two discussions because they can be discussed and implemented separately. This is the first of two discussions.
I'd propose the addition of two additional features for
Section.display_results()
. I've implemented both of these for my own personal use by subclassingSection
and creating my owndisplay_results
function, which is probably not a good idea for long-term use, but I didn't want to do a more elaborate implementation unless there's interest from others.file=
toSection.display_results()
andpost.print_results()
. The end ofpost.print_results(file=f)
can use therich.print()
function, which takes afile
argument to print to file:This will enable this to be consistent with the
print()
function to create titles and headers when using the package:My solution iterates over a
dict
made from theSectionProperties
comment block, and directly readsSectionProperties.<property>
, rather than using theSection.get_<property>()
functions likepost.print_results()
does so it needs a lot of work before it's ready for a PR, but the results that I propose look like this:Do these seem useful to others and worth further development?
Beta Was this translation helpful? Give feedback.
All reactions