Skip to content

Add documentation for types: scalars, lists, and NumPy arrays - #81

Merged
grzanka merged 15 commits into
mainfrom
types_page
Jul 29, 2026
Merged

Add documentation for types: scalars, lists, and NumPy arrays#81
grzanka merged 15 commits into
mainfrom
types_page

Conversation

@PiotrPich2024

@PiotrPich2024 PiotrPich2024 commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Added documentation about passed types and how they are converted into C variables.
Added warning inside documentation about passing wrong precision floating-point types numbers.

This pull request introduces documentation improvements and dependency updates to the project. The main focus is on enhancing the Python API documentation for data types and clarifying input/output handling, as well as updating project dependencies.

Documentation improvements:

  • Added a comprehensive new document (docs/python/types.md) detailing the accepted Python/NumPy data types for pyamtrack functions, including scalar and array-like inputs, broadcasting, output types, error handling, and practical recommendations. This will help users understand how to interact with the Python API and avoid common pitfalls.
  • Updated the README.md to fix the link to the documentation site, ensuring it uses the correct URL format.
  • Added a clarifying note in the README.md about the local server and file watching when running the documentation site.

Dependency updates:

  • Added the baseline-browser-mapping package to package.json dependencies, which may be required for improved browser compatibility or build tooling.

Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated

@grzanka grzanka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments

Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated

@grzanka grzanka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments

@PiotrPich2024
PiotrPich2024 marked this pull request as ready for review May 5, 2026 17:18
@grzanka
grzanka requested a review from Copilot May 6, 2026 13:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the libamtrack documentation site to better describe Python↔C type conversions for the pyamtrack wrapper, and fixes the top-level README link to the hosted docs site.

Changes:

  • Fix README link to use the canonical https://libamtrack.github.io URL.
  • Add a new docs/python/types.md page documenting Python input/output conversions (scalars, lists, NumPy arrays) for fully ported functions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
README.md Fixes documentation site link to include the https:// scheme.
docs/python/types.md Adds a type conversion reference page for key pyamtrack functions/modules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
@grzanka
grzanka requested a review from Copilot June 24, 2026 13:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 12 comments.

Comments suppressed due to low confidence (4)

docs/python/types.md:29

  • Grammar and wording issues in the array-like notes: “tuple and set is” should be plural, the inline “NOT IMPLEMENTED YET” is distracting, and “0-d python lists” isn’t a meaningful concept (lists are 1-D). Consider clarifying this as “empty Python lists” and “0‑D NumPy arrays”.
**Note:** `tuple` and `set` is not treated as array-like and will usually raise a `TypeError`. `NOT IMPLEMENTED YET`

**Note:** `0-d numpy.ndarray` and `0-d python lists` are treated as arrays-like type not scalars

docs/python/types.md:104

  • This list example both uses the undocumented E_MeV keyword and claims the output is a numpy.ndarray. Elsewhere in this docs set (e.g. docs/python/API/stopping/electron_range.md and docs/python/API/converters.md) list inputs are documented as returning Python lists. Please align this example with the established API docs to avoid confusing users.
E_MeV = [50.0, 100.0, 150.0]
range_m = pyamtrack.stopping.electron_range(E_MeV = E_MeV)
# E_MeV -> [50.0, 100.0, 150.0] MeV
# range_m -> numpy.ndarray([0.2537, 0.4245, 0.5689])  (shape (3,), dtype float64)
# range_m[i] corresponds to E_MeV[i], same order preserved

docs/python/types.md:207

  • This example again uses E_MeV= / material_id= / model_id= and describes a np.ndarray output for a list input. That contradicts the existing API docs in this repo, which document list inputs as returning Python lists (e.g. docs/python/API/stopping/electron_range.md, docs/python/API/converters.md). Please align the example and expected return type with the established documentation.
E_MeV = [50.0, 100.0]
range_m = pyamtrack.stopping.electron_range(E_MeV = E_MeV, material_id = 1, model_id = 7)
# material_id=1 and model_id=7 stay scalar -> broadcast to match E_MeV's length
# range_m -> np.ndarray([0.2537, 0.4245])  (shape=(2,), dtype=float64)
**docs/python/types.md:232**
* After switching the example to list inputs, the return type in this comment should be a Python list (as documented elsewhere in this repo for list inputs), not `np.ndarray`.

range_m -> np.ndarray([0.2537, 0.4245, 0.5689])

</details>


Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
Comment thread docs/python/types.md Outdated
@grzanka

grzanka commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts in ec5ddc2. The only conflict was in yarn.lock — resolved by taking the newer package versions from main (which contained the security dependency bumps for brace-expansion, follow-redirects, etc.).

Copilot AI requested a review from grzanka July 29, 2026 18:21
@grzanka
grzanka merged commit b3166f8 into main Jul 29, 2026
5 checks passed
@grzanka
grzanka deleted the types_page branch July 29, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants