-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3fac86b
commit 85aaede
Showing
42 changed files
with
453 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ notebooks/cmb/ | |
.pytest_cache/ | ||
tests/__pycache__/ | ||
docs/build/ | ||
docs/source/_build/ | ||
docs/source/_static/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import sbm | ||
import inspect | ||
import os | ||
|
||
def escape_underscores(name): | ||
return name.replace('_', '\\_') | ||
|
||
def is_special_method(name): | ||
return name.startswith('__') and name.endswith('__') | ||
|
||
def get_classes_and_methods(module): | ||
classes = inspect.getmembers(module, inspect.isclass) | ||
for class_name, class_obj in classes: | ||
escaped_class_name = escape_underscores(class_name) | ||
class_filename = f"sbm.{class_name}.rst" | ||
with open(class_filename, 'w') as class_file: | ||
class_file.write(f"sbm.{escaped_class_name}\n") | ||
class_file.write("=" * len(f"sbm.{escaped_class_name}") + "\n\n") | ||
class_file.write(f".. currentmodule:: sbm\n\n") | ||
class_file.write(f".. autoclass:: {class_name}\n\n") | ||
class_file.write(f" .. automethod:: __init__\n\n") | ||
class_file.write(f" .. rubric:: Methods\n\n") | ||
class_file.write(f" .. autosummary::\n\n") | ||
|
||
methods = inspect.getmembers(class_obj, inspect.isfunction) | ||
for method_name, method_obj in methods: | ||
if is_special_method(method_name): | ||
continue | ||
escaped_method_name = escape_underscores(method_name) | ||
class_file.write(f" ~{class_name}.{method_name}\n") | ||
method_filename = f"sbm.{class_name}.{method_name}.rst" | ||
with open(method_filename, 'w') as method_file: | ||
method_file.write(f"sbm.{escaped_class_name}.{escaped_method_name}\n") | ||
method_file.write("=" * len(f"sbm.{escaped_class_name}.{escaped_method_name}") + "\n\n") | ||
method_file.write(f".. currentmodule:: sbm\n\n") | ||
method_file.write(f".. automethod:: {class_name}.{method_name}\n") | ||
|
||
def get_functions(module): | ||
functions = inspect.getmembers(module, inspect.isfunction) | ||
for function_name, function_obj in functions: | ||
if is_special_method(function_name): | ||
continue | ||
escaped_function_name = escape_underscores(function_name) | ||
function_filename = f"sbm.{function_name}.rst" | ||
with open(function_filename, 'w') as function_file: | ||
function_file.write(f"sbm.{escaped_function_name}\n") | ||
function_file.write("=" * len(f"sbm.{escaped_function_name}") + "\n\n") | ||
function_file.write(f".. currentmodule:: sbm\n\n") | ||
function_file.write(f".. autofunction:: {function_name}\n") | ||
|
||
def generate_reference_rst(module, output_file): | ||
with open(output_file, 'w') as f: | ||
f.write("API Reference\n") | ||
f.write("=============\n\n") | ||
|
||
# Main functions | ||
f.write("Main functions\n") | ||
f.write("--------------\n\n") | ||
f.write(".. toctree::\n") | ||
f.write(".. autosummary::\n") | ||
f.write(" :toctree: generated/\n\n") | ||
|
||
functions = inspect.getmembers(module, inspect.isfunction) | ||
for function_name, function_obj in functions: | ||
if not is_special_method(function_name): | ||
f.write(f" sbm.{function_name}\n") | ||
f.write("\n") | ||
|
||
# Classes | ||
f.write("Classes\n") | ||
f.write("-------\n\n") | ||
f.write(".. toctree::\n") | ||
f.write(" :maxdepth: 2\n\n") | ||
f.write(".. autosummary::\n") | ||
f.write(" :toctree: generated/\n\n") | ||
|
||
classes = inspect.getmembers(module, inspect.isclass) | ||
for class_name, class_obj in classes: | ||
f.write(f" sbm.{class_name}\n") | ||
f.write("\n") | ||
|
||
# Methods | ||
f.write("Methods\n") | ||
f.write("-------\n\n") | ||
f.write(".. toctree::\n") | ||
f.write(" :maxdepth: 2\n\n") | ||
f.write(".. autosummary::\n") | ||
f.write(" :toctree: generated/\n") | ||
f.write(" :recursive:\n\n") | ||
|
||
for class_name, class_obj in classes: | ||
methods = inspect.getmembers(class_obj, inspect.isfunction) | ||
for method_name, method_obj in methods: | ||
if not is_special_method(method_name): | ||
f.write(f" sbm.{class_name}.{method_name}\n") | ||
f.write("\n") | ||
|
||
if __name__ == "__main__": | ||
# Create output directory if it doesn't exist | ||
output_dir = "generated" | ||
if not os.path.exists(output_dir): | ||
os.makedirs(output_dir) | ||
|
||
output_file = "reference.rst" | ||
generate_reference_rst(sbm, output_file) | ||
print(f"{output_file} has been generated successfully.") | ||
|
||
os.chdir(output_dir) | ||
|
||
print("Generating documentation files for sbm module...") | ||
|
||
get_classes_and_methods(sbm) | ||
get_functions(sbm) | ||
|
||
|
||
|
||
print("Documentation files generated successfully.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
sbm.Configlation | ||
================ | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. autoclass:: Configlation | ||
|
||
|
||
.. automethod:: __init__ | ||
|
||
|
||
.. rubric:: Methods | ||
|
||
.. autosummary:: | ||
|
||
~Configlation.__init__ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sbm.Field.conj | ||
============== | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. automethod:: Field.conj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
sbm.Field | ||
========= | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. autoclass:: Field | ||
|
||
|
||
.. automethod:: __init__ | ||
|
||
|
||
.. rubric:: Methods | ||
|
||
.. autosummary:: | ||
|
||
~Field.__init__ | ||
~Field.conj | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sbm.ScanFields.create\_covmat | ||
============================= | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. automethod:: ScanFields.create_covmat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sbm.ScanFields.generate\_noise | ||
============================== | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. automethod:: ScanFields.generate_noise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sbm.ScanFields.generate\_noise\_pdf | ||
=================================== | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. automethod:: ScanFields.generate_noise_pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
sbm.ScanFields.get_xlink | ||
====================== | ||
sbm.ScanFields.get\_xlink | ||
========================= | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. automethod:: ScanFields.get_xlink | ||
.. automethod:: ScanFields.get_xlink |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sbm.ScanFields.initialize | ||
========================= | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. automethod:: ScanFields.initialize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sbm.ScanFields.map\_make | ||
======================== | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. automethod:: ScanFields.map_make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,28 @@ | ||
sbm.ScanFields | ||
================= | ||
sbm.ScanFields | ||
============== | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. autoclass:: ScanFields | ||
|
||
|
||
.. automethod:: __init__ | ||
|
||
|
||
.. rubric:: Methods | ||
|
||
.. autosummary:: | ||
|
||
~ScanFields.__init__ | ||
~ScanFields.create_covmat | ||
~ScanFields.generate_noise | ||
~ScanFields.generate_noise_pdf | ||
~ScanFields.get_xlink | ||
~ScanFields.initialize | ||
~ScanFields.load_channel | ||
~ScanFields.load_det | ||
~ScanFields.load_full_FPU | ||
~ScanFields.map_make | ||
~ScanFields.t2b | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sbm.ScanFields.t2b | ||
================== | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. automethod:: ScanFields.t2b |
6 changes: 6 additions & 0 deletions
6
docs/source/generated/sbm.SignalFields.abs_pointing_field.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sbm.SignalFields.abs\_pointing\_field | ||
===================================== | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. automethod:: SignalFields.abs_pointing_field |
6 changes: 6 additions & 0 deletions
6
docs/source/generated/sbm.SignalFields.build_linear_system.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sbm.SignalFields.build\_linear\_system | ||
====================================== | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. automethod:: SignalFields.build_linear_system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sbm.SignalFields.diff\_gain\_field | ||
================================== | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. automethod:: SignalFields.diff_gain_field |
6 changes: 6 additions & 0 deletions
6
docs/source/generated/sbm.SignalFields.diff_pointing_field.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sbm.SignalFields.diff\_pointing\_field | ||
====================================== | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. automethod:: SignalFields.diff_pointing_field |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sbm.SignalFields.get\_coupled\_field | ||
==================================== | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. automethod:: SignalFields.get_coupled_field |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sbm.SignalFields.get\_field | ||
=========================== | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. automethod:: SignalFields.get_field |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sbm.SignalFields.hwp\_ip\_field | ||
=============================== | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. automethod:: SignalFields.hwp_ip_field |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
sbm.SignalFields | ||
================ | ||
|
||
.. currentmodule:: sbm | ||
|
||
.. autoclass:: SignalFields | ||
|
||
|
||
.. automethod:: __init__ | ||
|
||
|
||
.. rubric:: Methods | ||
|
||
.. autosummary:: | ||
|
||
~SignalFields.__init__ | ||
~SignalFields.abs_pointing_field | ||
~SignalFields.build_linear_system | ||
~SignalFields.diff_gain_field | ||
~SignalFields.diff_pointing_field | ||
~SignalFields.get_coupled_field | ||
~SignalFields.get_field | ||
~SignalFields.hwp_ip_field | ||
|
||
|
Oops, something went wrong.