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

Need Python documentation for Boost (C) objects #12

Open
demisjohn opened this issue Apr 11, 2018 · 3 comments
Open

Need Python documentation for Boost (C) objects #12

demisjohn opened this issue Apr 11, 2018 · 3 comments

Comments

@demisjohn
Copy link
Owner

From @demisjohn on March 7, 2018 13:51

Currently, getting help() on a boost object (defined in C I think), does not show any useful user-written documentation on how to use the object.

Should add documentation to clarify how to use these objects.

Example of help( camfr.Section ), which should say something like

 __init__( self, first_pass_modes, second_pass_modes)

The line s = Section(all, 10, 40) means we use (2*10+1)^2 plane waves in the first stage, and refine it using 40 1D modes in each Slab during the second stage.

instead we get a cryptic:

>>> help(c.Section)
Help on class Section in module camfr._camfr:

class Section(MultiWaveguide)
 |  Method resolution order:
 |      Section
 |      MultiWaveguide
 |      Waveguide
 |      Boost.Python.instance
 |      __builtin__.object
 |  
 |  Methods defined here:
 |  
 |  __init__(...)
 |      __init__( (object)arg1, (Expression)arg2 [, (int)arg3 [, (int)arg4]]) -> None :
 |      
 |          C++ signature :
 |              void __init__(_object*,Expression {lvalue} [,int [,int]])
 |      
 |      __init__( (object)arg1, (Expression)arg2, (Expression)arg3 [, (int)arg4 [, (int)arg5]]) -> None :
 |      
 |          C++ signature :
 |              void __init__(_object*,Expression {lvalue},Expression {lvalue} [,int [,int]])
 |      
 |      __init__( (object)arg1, (Term)arg2) -> None :
 |      
 |          C++ signature :
 |              void __init__(_object*,Term)
 |  
 |  __reduce__ = <unnamed Boost.Python function>(...)
 |  
 |  disp(...)
 |      disp( (Section)arg1, (complex)arg2) -> complex :
 |      
 |          C++ signature :
 |              std::__1::complex<double> disp(Section {lvalue},std::__1::complex<double>)
 |  
 |  eps(...)
 |      eps( (Section)arg1, (Coord)arg2) -> complex :
 |      
 |          C++ signature :
 |              std::__1::complex<double> eps(Section {lvalue},Coord)
 |  
 |  height(...)
 |      height( (Section)arg1) -> float :
 |      
 |          C++ signature :
 |              double height(Section {lvalue})
 |  
 |  mode(...)
 |      mode( (Section)arg1, (int)arg2) -> SectionMode :
 |      
 |          C++ signature :
 |              SectionMode* mode(Section,int)
 |  
 |  mu(...)
 |      mu( (Section)arg1, (Coord)arg2) -> complex :
 |      
 |          C++ signature :
 |              std::__1::complex<double> mu(Section {lvalue},Coord)
 |  
 |  n(...)
 |      n( (Section)arg1, (Coord)arg2) -> complex :
 |      
 |          C++ signature :
 |              std::__1::complex<double> n(Section {lvalue},Coord)
 |  
 |  set_estimate(...)
 |      set_estimate( (Section)arg1, (complex)arg2) -> None :
 |      
 |          C++ signature :
 |              void set_estimate(Section {lvalue},std::__1::complex<double>)
 |  
 |  set_sorting(...)
 |      set_sorting( (Section)arg1, (Sort_type)arg2) -> None :
 |      
 |          C++ signature :
 |              void set_sorting(Section {lvalue},Sort_type)
 |  
 |  width(...)
 |      width( (Section)arg1) -> float :
 |      
 |          C++ signature :
 |              double width(Section {lvalue})
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |  
 |  __instance_size__ = 120
 |  
 |  ----------------------------------------------------------------------

Copied from original issue: #8

@demisjohn
Copy link
Owner Author

Can just add a python script file, which adds a __doc__ string literal """ to each object, although docstring and actual code would then be separated into different files which is not ideal.

@demisjohn
Copy link
Owner Author

@demisjohn
Copy link
Owner Author

@jsenellart , do you have any insight into this issue? This is something I would love to work on, but the C/BOOST/Python wrapper functionality is beyond my pay grade. I'd love to find a way to type the Python docstring directly into the cpp file where the functions are defined, rather than in a separate python file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant