-
Notifications
You must be signed in to change notification settings - Fork 0
Add documentation for particle properties and usage examples #88
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
base: main
Are you sure you want to change the base?
Changes from all commits
d44f817
7305c56
11f6a7e
e582892
ac1ac97
018bc1f
bed88d5
d16cca9
ec97b19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,76 @@ | ||||||||
| # Particles | ||||||||
|
|
||||||||
| The library provides a comprehensive particle system for particle transport calculations, including predefined particles commonly used in particle therapy and radiation physics. | ||||||||
|
|
||||||||
| ## Overview | ||||||||
|
|
||||||||
| Each particle is characterized by physical properties, including its identifier, element name and acronym, mass number (`A`), and atomic number (`Z`). | ||||||||
|
|
||||||||
| ## Particle Properties | ||||||||
|
|
||||||||
| Each Particle object has the following properties: | ||||||||
|
|
||||||||
| - **id** (`int`): Unique identifier for the particle | ||||||||
| - **element_name** (`str`): Name of the particle element | ||||||||
| - **A** (`int`): Mass number | ||||||||
| - **Z** (`float`): Atomic number | ||||||||
| - **I_eV_per_Z** (`float`): Ionization energy per proton | ||||||||
| - **density_g_cm3** (`float`): Density \[g/cm3\] | ||||||||
| - **element_acronym** (`str`): Acronym of the particle element | ||||||||
| - **atomic_weight** (`float`): Atomic weight - average mass of element’s isotopes | ||||||||
|
|
||||||||
| ## Using Particles | ||||||||
|
|
||||||||
| ### Creating Particle Objects | ||||||||
| There are a few ways a particle object can be created: | ||||||||
| - Using predefined particle constants | ||||||||
|
|
||||||||
| ```python | ||||||||
|
witNie marked this conversation as resolved.
|
||||||||
| import pyamtrack.particles | ||||||||
| carbon = pyamtrack.particles.C | ||||||||
| ``` | ||||||||
|
|
||||||||
| - Using a particle code (Z*1000 + A) | ||||||||
| ```python | ||||||||
| carbon = pyamtrack.particles.Particle.from_number(6012) | ||||||||
| ``` | ||||||||
| - Using nuclide notation string (e.g., "12C") | ||||||||
| ```python | ||||||||
| carbon = pyamtrack.particles.Particle.from_string("12C") | ||||||||
| ``` | ||||||||
|
|
||||||||
| - Using atomic number (Z) directly | ||||||||
| ```python | ||||||||
|
||||||||
| ```python | |
| ```python | |
| import pyamtrack.particles |
Copilot
AI
Apr 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
energies is used in this example but never defined, so the snippet isn’t runnable as-written. Please define energies (e.g., a list or numpy array) within the example code block.
Copilot
AI
Apr 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example also calls stopping_power(energies, ...) but energies isn’t defined within the snippet. Please define it in the block so the example is copy-pastable.
Copilot
AI
Apr 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the “Particle code” example, the formula is written as (A*1000 + Z), but earlier in this page you define the code as (Z*1000 + A) and the example value 6012 matches Z*1000 + A. Please make the formula consistent here to avoid users passing the wrong identifier.
| - Particle code (A*1000 + Z) | |
| - Particle code (Z*1000 + A) |
Copilot
AI
Apr 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
energies is still undefined in this example, so it won’t run if copied as-is. Please add a definition for energies inside the snippet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The density unit is written as
\[g/cm3\](and has a trailing space). Other API pages useg/cm³without escaping; aligning the unit formatting here would improve consistency and readability.