tmolteno / python-necpp

PyPI module for nec2++
GNU General Public License v2.0
62 stars 26 forks source link

Documentation? #22

Open Nothing-Burger-Left-Pizza opened 2 years ago

Nothing-Burger-Left-Pizza commented 2 years ago

-Undocumented arguments in wire method. What are they? -Segment voltage and current? get_structure_currents () returns a unrecognized object. How to parse this? -Feedpoint impedance?

mike6000 commented 2 years ago

This may give you some hints http://www.nec2.org/part_3/toc.html

Nothing-Burger-Left-Pizza commented 2 years ago

I am thoroughly familiar with NEC-2, having used it regularly for over 10 years, so a pointer to NEC-2 documentation does not help. As I said, the wire method has arguments that are undocumented. They do not appear in the NEC-2 documentation. What are they???? The get_structure_currents method returns an object. Again, the NEC-2 documentation is silent on this (no surprise, inasmuch as NEC-2 was written decades before this implementation). Even a doxygen file would be helpful. With an undocumented API, the only option is to simply run one of the NEC-2 programs and parse the output.

LukeAllen commented 2 years ago

This is my first time attempting to use NEC-2, and I second the request -- I'd love to use this library but without documentation of the function inputs, it's not really possible. For example, for ex_card the only thing that can be seen in the code is this:

def nec_context_ex_card(*args, **kwargs): # real signature unknown
    pass

And the C++ library that this wraps also has no documentation (unless I'm just failing to find it). The FORTRAN documentation is too far removed from this code to help me figure things out.

daniel-ayers commented 1 year ago

-Undocumented arguments in wire method. What are they?

The last two parameters pertain to tapered wires, for non-tapered wires set both to 1.0.

The Python implementation is just a wrapper around the C++ code so you could look at the C++ code to identify what parameters and return types are. Alternatively you could refer to the (probably more convenient) interface files, for example https://github.com/tmolteno/python-necpp/blob/master/PyNEC/interface_files/c_geometry.i#L5 .

-Segment voltage and current? get_structure_currents () returns a unrecognized object. How to parse this?

get_structure_currents() returns an nec_structure_currents object as described here: https://github.com/tmolteno/python-necpp/blob/master/PyNEC/interface_files/nec_context.i#L92

That object is defined here https://github.com/tmolteno/python-necpp/blob/master/PyNEC/interface_files/nec_structure_currents.i .

-Feedpoint impedance?

If you mean for a transmission line, then it is specified on a TL card as per usual: https://github.com/tmolteno/python-necpp/blob/master/PyNEC/interface_files/nec_context.i#L301

If you mean figuring out the impedence of the modelled antenna, you might find the examples in dipole.py useful, such as https://github.com/tmolteno/python-necpp/blob/master/PyNEC/example/dipole.py#L44 .

daniel-ayers commented 1 year ago

This is my first time attempting to use NEC-2, and I second the request -- I'd love to use this library but without documentation of the function inputs, it's not really possible.

This code isn't going to teach you NEC-2, knowledge of the input card format described in http://www.nec2.org/other/nec2prt3.pdf is a prerequisite.

For example, for ex_card the only thing that can be seen in the code is this:

The Python wrapper is described in the interface files. The EX card is complex (pardon the pun), it is described from page 48 of the above link and the Python version here in the interface files: https://github.com/tmolteno/python-necpp/blob/master/PyNEC/interface_files/nec_context.i#L215

The FORTRAN documentation is too far removed from this code to help me figure things out.

Everything is very closely based on the original input specification - and there are interface files that clarify the Python wrapper.

aeropung commented 1 year ago

This code isn't going to teach you NEC-2, knowledge of the input card format described in http://www.nec2.org/other/nec2prt3.pdf is a prerequisite.

This is only true to a point, though, right? For instance, the PyNEC card descriptions clearly state the presence of a pl_card (line 576), but there is no PL card in the documentation you point to. I would love to know if this function will ever be complete, if it will be removed (since no parameters are defined for itmp1 - itmp4), or if I'm looking in the wrong place in the NEC2 documentation.

Nothing-Burger-Left-Pizza commented 1 year ago

"This code isn't going to teach you NEC-2, knowledge of the input card format described in http://www.nec2.org/other/nec2prt3.pdf is a prerequisite."

NEC-2 power-user here; knowing NEC-2 is of no use here because the interface is undocumented.