Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark2000 committed May 29, 2024
1 parent a7adf00 commit fdff05b
Show file tree
Hide file tree
Showing 14 changed files with 297 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Multiagent Environment Test"
"# Multi-Agent Environments"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Multiagent Environment Test\n",
"\n",
"## Subheading here"
"# Training with RLlib"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n"
]
}
],
"source": [
"import time\n",
"from bsk_rl.scene import CityTargets\n",
"\n",
"print(CityTargets(500))\n",
"time.sleep(3)\n",
"if 1 > 0:\n",
" print(\"True in source\")\n",
" "
" print(\"True\")"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,25 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Multiagent Environment Test\n",
"\n",
"## Subheading here"
"# Satellite Configuration"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-29T19:26:06.666614Z",
"iopub.status.busy": "2024-05-29T19:26:06.666413Z",
"iopub.status.idle": "2024-05-29T19:26:10.462606Z",
"shell.execute_reply": "2024-05-29T19:26:10.461898Z"
}
},
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<bsk_rl.scene.targets.CityTargets object at 0x12e942ef0>\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"True in source\n"
"True\n"
]
}
],
"source": [
"import time\n",
"from bsk_rl.scene import CityTargets\n",
"\n",
"print(CityTargets(500))\n",
"time.sleep(3)\n",
"if 1 > 0:\n",
" print(\"True in source\")\n",
" "
" print(\"True\")"
]
}
],
Expand Down
50 changes: 50 additions & 0 deletions docs/build/doctrees/nbsphinx/Examples/simple_environment.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Satellite Configuration"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n"
]
}
],
"source": [
"if 1 > 0:\n",
" print(\"True\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv_refactor",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
26 changes: 20 additions & 6 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import os
import re
import shutil
import sys
from importlib import metadata
from pathlib import Path
Expand Down Expand Up @@ -99,9 +100,6 @@ def __init__(self, base_source_dir, base_doc_dir, filter_all=True):

def grab_files(self, dir_path):
dirs_in_dir = [x for x in dir_path.iterdir() if x.is_dir()]
files_in_dir = dir_path.glob("*.py")

# Remove any directories that shouldn't be added directly to the website
dir_filters = [
r".*__pycache__.*",
r".*\.ruff_cache.*",
Expand All @@ -118,6 +116,7 @@ def grab_files(self, dir_path):
)
)

files_in_dir = dir_path.glob("*.py")
file_filters = [
r".*__init__\.py",
r"(.*\/|)_[a-zA-Z0-9_]*\.py",
Expand All @@ -143,7 +142,13 @@ def grab_files(self, dir_path):
)
)

return sorted(list(files_in_dir)), sorted(list(dirs_in_dir))
notebooks_in_dir = dir_path.glob("*.ipynb")

return (
sorted(list(files_in_dir)),
sorted(list(dirs_in_dir)),
sorted(list(notebooks_in_dir)),
)

def generate_index(self, index_path, file_paths, dir_paths, source_dir):
# Make header
Expand Down Expand Up @@ -257,13 +262,13 @@ def run(self, source_dir=None):
if source_dir is None:
source_dir = self.base_source_dir

file_paths, dir_paths = self.grab_files(source_dir)
file_paths, dir_paths, nb_paths = self.grab_files(source_dir)
index_path = source_dir.relative_to(self.base_source_dir)

# Populate the index.rst file of the local directory
os.makedirs(self.base_doc_dir / index_path, exist_ok=True)
self.generate_index(
self.base_doc_dir / index_path, file_paths, dir_paths, source_dir
self.base_doc_dir / index_path, file_paths + nb_paths, dir_paths, source_dir
)

# Generate the correct auto-doc function for python modules
Expand All @@ -273,6 +278,15 @@ def run(self, source_dir=None):
file,
)

for notebook in nb_paths:
print(
"COPYING",
notebook,
"TO",
self.base_doc_dir / index_path / notebook.name,
)
shutil.copy(notebook, self.base_doc_dir / index_path / notebook.name)

# Recursively go through all directories in source, documenting what is available.
for dir_path in sorted(dir_paths):
self.run(
Expand Down
1 change: 0 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ BSK-RL: Environments Spacecraft Planning and Scheduling
release_notes
publications
citation
multiagent_envs_src
GitHub <https://github.com/AVSLab/bsk_rl/>


Expand Down
10 changes: 10 additions & 0 deletions examples/_default.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Examples
========

.. toctree::
:maxdepth: 1

simple_environment
satellite_configuration
rllib_training
multiagent_envs
5 changes: 0 additions & 5 deletions examples/_doc.rst

This file was deleted.

50 changes: 50 additions & 0 deletions examples/multiagent_envs.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Multi-Agent Environments"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n"
]
}
],
"source": [
"if 1 > 0:\n",
" print(\"True\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv_refactor",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
50 changes: 50 additions & 0 deletions examples/rllib_training.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Training with RLlib"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"True\n"
]
}
],
"source": [
"if 1 > 0:\n",
" print(\"True\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv_refactor",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Empty file removed examples/rllib_training.py
Empty file.
Loading

0 comments on commit fdff05b

Please sign in to comment.