Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glue Variables in User_Guide #615

Open
wants to merge 67 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
7374d1a
glue variables in off_design_missions.ipynb
xjjiang Nov 28, 2024
a57e8c2
update how_to_contribute_docs.md
xjjiang Nov 28, 2024
202d3e4
update how_to_contribute_docs.md
xjjiang Nov 28, 2024
361523f
glue variables in docs/user_guide/mass.ipynb
xjjiang Nov 29, 2024
d56e7af
add glue in aerodynamics.ipynb
xjjiang Nov 30, 2024
5aead60
add glue in aviary_commands.ipynb
xjjiang Nov 30, 2024
2f081f7
minor update
xjjiang Nov 30, 2024
a8f9c8b
update docstring
xjjiang Nov 30, 2024
cabf87a
format aviary command options source code
xjjiang Dec 3, 2024
61c2389
add glue to aviary_commands.ipynb
xjjiang Dec 3, 2024
ff462c0
Merge branch 'OpenMDAO:main' into glue_user_guide
xjjiang Dec 3, 2024
9073067
Merge branch 'OpenMDAO:main' into glue_user_guide
xjjiang Dec 5, 2024
2d16a94
format _setup_level1_parser in methods_for_level1.py
xjjiang Dec 5, 2024
ecc22dc
autopep8
xjjiang Dec 5, 2024
1829237
minor
xjjiang Dec 5, 2024
610e082
Merge branch 'OpenMDAO:main' into glue_user_guide
xjjiang Dec 6, 2024
ff90a0a
Merge branch 'OpenMDAO:main' into glue_user_guide
xjjiang Dec 6, 2024
b13d7ba
Merge branch 'OpenMDAO:main' into glue_user_guide
xjjiang Dec 6, 2024
4167a08
move aviary hangar to the end of aviary_commands.ipynb because it cau…
xjjiang Dec 7, 2024
968a62d
glue variables in battery_subsystem_example.ipynb
xjjiang Dec 7, 2024
1c37f92
glue variables in drawing_and_running_simple_missions.ipynb
xjjiang Dec 9, 2024
439a61d
glue variables in drawing_and_running_simple_missions.ipynb and examp…
xjjiang Dec 9, 2024
e291aa2
glue variables in external_aero.ipynb
xjjiang Dec 9, 2024
af117c7
add glue variables to features_and_functionalities.ipynb
xjjiang Dec 10, 2024
028f229
minor update
xjjiang Dec 10, 2024
f794777
glue variables in FLOPS_based_detailed_takeoff_and_landing.ipynb
xjjiang Dec 10, 2024
e779ba0
glue variables in hamilton_standard.ipynb
xjjiang Dec 10, 2024
01cf911
glue variables in input_files.ipynb
xjjiang Dec 10, 2024
0e93159
glue variables in postprocessing_and_visualizing_results.ipynb
xjjiang Dec 11, 2024
30c6d3b
work in progress
xjjiang Dec 11, 2024
b30e556
glue variables in propulsion.ipynb
xjjiang Dec 12, 2024
46191d2
remove a print statement
xjjiang Dec 12, 2024
d049174
glue variables in reserve_missions.ipynb
xjjiang Dec 12, 2024
7c8a7d7
glue variables in SGM_capabilities.ipynb
xjjiang Dec 12, 2024
5e05674
glue variables in step_by_step_external_guide.ipynb
xjjiang Dec 13, 2024
fb5d88a
minor update to step_by_step_external_guide.ipynb
xjjiang Dec 13, 2024
a0e151f
remove outputs
xjjiang Dec 13, 2024
677f206
minor updates
xjjiang Dec 13, 2024
7e8d414
glue variables in variable_hierarchy.ipynb and variable_metadata.ipynb
xjjiang Dec 14, 2024
8842366
glue variables in overriding.ipynb
xjjiang Dec 14, 2024
75a5453
glue variables in externally_supported_subsystems.ipynb and modeling_…
xjjiang Dec 14, 2024
570f05a
move get_class_names() and get_function_names() to doctape.py
xjjiang Dec 16, 2024
1ce5e76
move get_class_names() and get_function_names() to doctape.py
xjjiang Dec 16, 2024
ba1f04e
polish glue task
xjjiang Dec 17, 2024
ca176dd
further polish
xjjiang Dec 17, 2024
bd52c14
Merge branch 'OpenMDAO:main' into glue_user_guide
xjjiang Dec 17, 2024
b7278ac
autopep8
xjjiang Dec 17, 2024
ce353c8
docpage update
xjjiang Dec 17, 2024
cc1eb0f
add two utility functions: get_class_names and get_function_names
xjjiang Dec 17, 2024
5f26f69
Merge branch 'main' into glue_user_guide
xjjiang Dec 18, 2024
b97f574
rename Aircraft.Engine.COMPUTE_PROPELLER_INSTALLATION_LOSS to Aircraf…
xjjiang Dec 18, 2024
7354357
rename Aircraft.Engine.COMPUTE_INSTALLATION_LOSS to Aircraft.Engine.P…
xjjiang Dec 18, 2024
641371a
Update hamilton_standard.ipynb
xjjiang Dec 18, 2024
a029c94
Update hamilton_standard.ipynb
xjjiang Dec 18, 2024
37a44a7
Update hamilton_standard.ipynb
xjjiang Dec 18, 2024
9a4dd57
Merge branch 'OpenMDAO:main' into glue_user_guide
xjjiang Dec 31, 2024
c6448c5
Merge branch 'main' into glue_user_guide
xjjiang Jan 7, 2025
a1dba9b
Merge branch 'OpenMDAO:main' into glue_user_guide
xjjiang Jan 9, 2025
1b4e910
very minor update
xjjiang Jan 9, 2025
95ab9ab
Merge branch 'OpenMDAO:main' into glue_user_guide
xjjiang Jan 14, 2025
4bbce12
accept Carl's suggestions: modify the glue of paths and the glue of '…
xjjiang Jan 15, 2025
8c20e6e
modify the usage of Argparser as suggested by Carl.
xjjiang Jan 15, 2025
126eca1
make changes based on Carl's comments.
xjjiang Jan 16, 2025
5555157
Merge branch 'OpenMDAO:main' into glue_user_guide
xjjiang Jan 17, 2025
018056d
Merge branch 'OpenMDAO:main' into glue_user_guide
xjjiang Jan 18, 2025
8a384b0
Merge branch 'main' into glue_user_guide
xjjiang Jan 22, 2025
d95fefa
Merge branch 'OpenMDAO:main' into glue_user_guide
xjjiang Jan 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
modify the usage of Argparser as suggested by Carl.
xjjiang committed Jan 15, 2025
commit 8c20e6e45ffb50c4cf142f28c0e1a77b5aa384ef
205 changes: 102 additions & 103 deletions aviary/docs/user_guide/aviary_commands.ipynb
Original file line number Diff line number Diff line change
@@ -144,10 +144,7 @@
"command = 'aviary run_mission ' + str_folder + '/' + str_model\n",
"glue_variable(command, md_code=True)\n",
"command += ' --max_iter 0 --optimizer IPOPT' # max_iter to limit build time, IPOPT to run on CI\n",
"subprocess.run(command.split()).check_returncode();\n",
"\n",
"\n",
"\n"
"subprocess.run(command.split()).check_returncode();\n"
]
},
{
@@ -184,37 +181,37 @@
"outputs": [],
"source": [
"# Testing Cell\n",
"import argparse\n",
"import aviary.api as av\n",
"from aviary.interface.methods_for_level1 import _setup_level1_parser, run_level_1\n",
"from aviary.interface.methods_for_level1 import run_level_1\n",
"from aviary.utils.doctape import glue_variable\n",
"import inspect\n",
"\n",
"current_opt_vars = []\n",
"\n",
"# glue all the options of 'aviary run_mission'\n",
"source_code = inspect.getsource(_setup_level1_parser)\n",
"new_line = ''\n",
"for ch in source_code:\n",
" if ch == '\\n':\n",
" new_line = new_line.strip()\n",
" if new_line.startswith('\\\"-') or new_line.startswith(\"'-\"):\n",
" skey = new_line.split(',')[0][1:-1]\n",
" if skey == '-o':\n",
" glue_variable('--outdir', md_code=True)\n",
" glue_variable(skey, md_code=True)\n",
" elif new_line.startswith('\\\"') or new_line.startswith(\"'\"):\n",
" skey = new_line.split(',')[0][1:-1]\n",
" if len(skey) > 1:\n",
" glue_variable(skey, md_code=True)\n",
" new_line = ''\n",
" else:\n",
" new_line += ch\n",
"command = 'run_mission'\n",
"parser = argparse.ArgumentParser()\n",
"_command_map[command][0](parser)\n",
"actions = [*parser._get_optional_actions(),*parser._get_positional_actions()]\n",
"for action in actions:\n",
" opt_list = action.option_strings\n",
" for opt in opt_list:\n",
" glue_variable(opt, md_code=True)\n",
" current_opt_vars.append(opt)\n",
" if action.dest not in current_opt_vars:\n",
" glue_variable(action.dest, md_code=True)\n",
" current_opt_vars.append(action.dest)\n",
"\n",
"glue_variable(av.EquationsOfMotion.HEIGHT_ENERGY.value, md_code=False, display=True)\n",
"glue_variable(av.EquationsOfMotion.TWO_DEGREES_OF_FREEDOM.value, md_code=False, display=True)\n",
"glue_variable(av.EquationsOfMotion.SOLVED_2DOF.value, md_code=False, display=True)\n",
"\n",
"# obtain the default value of maximum number of iterations from function run_level_1().\n",
"max_iter = inspect.signature(run_level_1).parameters['max_iter'].default\n",
"glue_variable('max_iter', str(max_iter), md_code=False)\n",
"if 'max_iter' not in current_opt_vars:\n",
" glue_variable('max_iter', str(max_iter), md_code=False)\n",
" current_opt_vars.append('max_iter')\n",
"\n"
]
},
@@ -243,31 +240,24 @@
"outputs": [],
"source": [
"# Testing Cell\n",
"import aviary.api as av\n",
"from aviary.utils.fortran_to_aviary import _setup_F2A_parser\n",
"from aviary.utils.doctape import glue_variable\n",
"import inspect\n",
"\n",
"print(current_opt_vars)\n",
"\n",
"# glue all the options of 'aviary fortran_to_aviary'\n",
"source_code = inspect.getsource(_setup_F2A_parser)\n",
"new_line = ''\n",
"for ch in source_code:\n",
" if ch == '\\n':\n",
" new_line = new_line.strip()\n",
" if new_line.startswith('\\\"-') or new_line.startswith(\"'-\"):\n",
" skey = new_line.split(',')[0][1:-1]\n",
" if skey != '-o' and skey != '--verbosity':\n",
" glue_variable(skey, md_code=True)\n",
" new_line = ''\n",
" else:\n",
" new_line += ch\n",
"\n",
"# experimenting\n",
"# import argparse\n",
"# parser = argparse.ArgumentParser()\n",
"# _setup_F2A_parser(parser)\n",
"# options = [action.dest for action in parser._actions]\n",
"# print(\"Options:\", options)\n"
"command = 'fortran_to_aviary'\n",
"parser = argparse.ArgumentParser()\n",
"_command_map[command][0](parser)\n",
"actions = [*parser._get_optional_actions(),*parser._get_positional_actions()]\n",
"for action in actions:\n",
" opt_list = action.option_strings\n",
" for opt in opt_list:\n",
" if opt not in current_opt_vars:\n",
" glue_variable(opt, md_code=True)\n",
" current_opt_vars.append(opt)\n",
" if action.dest not in current_opt_vars:\n",
" glue_variable(action.dest, md_code=True)\n",
" current_opt_vars.append(action.dest)\n"
]
},
{
@@ -347,25 +337,22 @@
"outputs": [],
"source": [
"# Testing Cell\n",
"import aviary.api as av\n",
"from aviary.utils.engine_deck_conversion import _setup_EDC_parser\n",
"from aviary.utils.doctape import glue_variable\n",
"import inspect\n",
"\n",
"# glue all the options of 'aviary convert_engine'\n",
"source_code = inspect.getsource(_setup_EDC_parser)\n",
"new_line = ''\n",
"for ch in source_code:\n",
" if ch == '\\n':\n",
" new_line = new_line.strip()\n",
" if new_line.startswith('\\\"-') or new_line.startswith(\"'-\"):\n",
" skey = new_line.split(',')[0][1:-1]\n",
" if skey != '-o':\n",
" glue_variable(skey, md_code=True)\n",
" new_line = ''\n",
" else:\n",
" new_line += ch\n",
"\n"
"command = 'convert_engine'\n",
"parser = argparse.ArgumentParser()\n",
"_command_map[command][0](parser)\n",
"actions = [*parser._get_optional_actions(),*parser._get_positional_actions()]\n",
"for action in actions:\n",
" opt_list = action.option_strings\n",
" for opt in opt_list:\n",
" if opt not in current_opt_vars:\n",
" glue_variable(opt, md_code=True)\n",
" current_opt_vars.append(opt)\n",
" if action.dest not in current_opt_vars:\n",
" glue_variable(action.dest, md_code=True)\n",
" current_opt_vars.append(action.dest)\n"
]
},
{
@@ -455,31 +442,23 @@
"outputs": [],
"source": [
"# Testing Cell\n",
"import aviary.api as av\n",
"from aviary.utils.aero_table_conversion import _setup_ATC_parser\n",
"from aviary.utils.doctape import check_contains\n",
"import inspect\n",
"import argparse\n",
"\n",
"# glue all the options of 'aviary fortran_to_aviary'\n",
"source_code = inspect.getsource(_setup_ATC_parser)\n",
"new_line = ''\n",
"options = []\n",
"for ch in source_code:\n",
" if ch == '\\n':\n",
" new_line = new_line.strip()\n",
" if new_line.startswith('\\\"-') or new_line.startswith(\"'-\"):\n",
" skey = new_line.split(',')[0][1:-1]\n",
" options.append(skey)\n",
" new_line = ''\n",
" else:\n",
" new_line += ch\n",
"\n",
"# glue all the options of 'aviary convert_aero_table'\n",
"command = 'convert_aero_table'\n",
"parser = argparse.ArgumentParser()\n",
"_setup_ATC_parser(parser)\n",
"options2 = [action.dest for action in parser._actions]\n",
"options.append(options2)\n",
"check_contains(['-f', '--data_format'], options)\n"
"_command_map[command][0](parser)\n",
"actions = [*parser._get_optional_actions(),*parser._get_positional_actions()]\n",
"for action in actions:\n",
" opt_list = action.option_strings\n",
" for opt in opt_list:\n",
" if opt not in current_opt_vars:\n",
" glue_variable(opt, md_code=True)\n",
" current_opt_vars.append(opt)\n",
" if action.dest not in current_opt_vars:\n",
" glue_variable(action.dest, md_code=True)\n",
" current_opt_vars.append(action.dest)\n",
"\n"
]
},
{
@@ -623,6 +602,32 @@
"!aviary convert_prop_table -h"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"# glue all the options of 'aviary convert_prop_table'\n",
"command = 'convert_prop_table'\n",
"parser = argparse.ArgumentParser()\n",
"_command_map[command][0](parser)\n",
"actions = [*parser._get_optional_actions(),*parser._get_positional_actions()]\n",
"for action in actions:\n",
" opt_list = action.option_strings\n",
" for opt in opt_list:\n",
" if opt not in current_opt_vars:\n",
" glue_variable(opt, md_code=True)\n",
" current_opt_vars.append(opt)\n",
" if action.dest not in current_opt_vars:\n",
" glue_variable(action.dest, md_code=True)\n",
" current_opt_vars.append(action.dest)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
@@ -663,28 +668,22 @@
"outputs": [],
"source": [
"# Testing Cell\n",
"import aviary.api as av\n",
"from aviary.visualization.dashboard import _dashboard_setup_parser\n",
"from aviary.utils.doctape import glue_variable\n",
"import inspect\n",
"\n",
"# glue all the options of 'aviary run_mission'\n",
"source_code = inspect.getsource(_dashboard_setup_parser)\n",
"new_line = ''\n",
"for ch in source_code:\n",
" if ch == '\\n':\n",
" new_line = new_line.strip()\n",
" if new_line.startswith('\\\"-') or new_line.startswith(\"'-\"):\n",
" skey = new_line.split(',')[0][1:-1]\n",
" if skey != '-d' and skey != '--force':\n",
" glue_variable(skey, md_code=True)\n",
" elif new_line.startswith('\\\"') or new_line.startswith(\"'\"):\n",
" skey = new_line.split(',')[0][1:-1]\n",
" if len(skey) > 1:\n",
" glue_variable(skey, md_code=True)\n",
" new_line = ''\n",
" else:\n",
" new_line += ch\n"
"# glue all the options of 'aviary dashboard'\n",
"command = 'dashboard'\n",
"parser = argparse.ArgumentParser()\n",
"_command_map[command][0](parser)\n",
"actions = [*parser._get_optional_actions(),*parser._get_positional_actions()]\n",
"for action in actions:\n",
" opt_list = action.option_strings\n",
" for opt in opt_list:\n",
" if opt not in current_opt_vars:\n",
" glue_variable(opt, md_code=True)\n",
" current_opt_vars.append(opt)\n",
" if action.dest not in current_opt_vars:\n",
" glue_variable(action.dest, md_code=True)\n",
" current_opt_vars.append(action.dest)\n"
]
},
{