Skip to content

Commit

Permalink
add new tutorials to index, fix small docs issues
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonReinhard committed Jan 27, 2025
1 parent 5f8f42f commit 6913853
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 34 deletions.
31 changes: 19 additions & 12 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,19 @@ open(readme_path, "r") do readme_in
end

# setup interlinks
links = InterLinks("QEDcore" => "https://qedjl-project.github.io/QEDcore.jl/dev/")
links = InterLinks(
"QEDcore" => "https://qedjl-project.github.io/QEDcore.jl/dev/",
"QEDprocesses" => "https://qedjl-project.github.io/QEDprocesses.jl/dev/",
)

# setup Bibliography
bib = CitationBibliography(joinpath(dirname(Base.active_project()), "Bibliography.bib"))

# setup examples using Literate.jl
literate_paths = [
Base.Filesystem.joinpath(project_path, "docs/src/tutorial/four_momentum.jl"),
Base.Filesystem.joinpath(project_path, "docs/src/tutorial/lorentz_vectors.jl"),
Base.Filesystem.joinpath(project_path, "docs/src/tutorial/model.jl"),
Base.Filesystem.joinpath(project_path, "docs/src/tutorial/particle.jl"),
Base.Filesystem.joinpath(project_path, "docs/src/tutorial/particle_stateful.jl"),
Base.Filesystem.joinpath(project_path, "docs/src/tutorial/process.jl"),
Expand All @@ -52,26 +57,28 @@ tutorial_output_dir_name = splitpath(tutorial_output_dir)[end]

pages = [
"Home" => "index.md",
"Phase Space Points" => "phase_space_point.md",
"Tutorials" => [
#"Dirac Tensors" => "dirac_tensors.md",
"Four Momentum" => joinpath(tutorial_output_dir_name, "four_momentum.md"),
"Lorentz Vectors" => joinpath(tutorial_output_dir_name, "lorentz_vectors.md"),
"Particles" => joinpath(tutorial_output_dir_name, "particle.md"),
"Stateful Particles" =>
joinpath(tutorial_output_dir_name, "particle_stateful.md"),
"Physics Model" => joinpath(tutorial_output_dir_name, "model.md"),
"Scattering Process" => joinpath(tutorial_output_dir_name, "process.md"),
"Phase Space Points" =>
joinpath(tutorial_output_dir_name, "phase_space_point.md"),
],
"API reference" => [
"Contents" => "library/outline.md",
"Lorentz vectors" => "library/lorentz_vector.md",
"Dirac tensors" => "library/dirac_objects.md",
"Particles" => "library/particles.md",
"Scattering process" => "library/process.md",
"Phase space layout" => "library/phase_space_layout.md",
"Phase space description" => "library/phase_space.md",
"Probability and cross section" => "library/cross_section.md",
"Function index" => "library/function_index.md",
"Contents" => joinpath("library", "outline.md"),
"Lorentz vectors" => joinpath("library", "lorentz_vector.md"),
"Dirac tensors" => joinpath("library", "dirac_objects.md"),
"Particles" => joinpath("library", "particles.md"),
"Scattering process" => joinpath("library", "process.md"),
"Phase space layout" => joinpath("library", "phase_space_layout.md"),
"Phase space description" => joinpath("library", "phase_space.md"),
"Probability and cross section" => joinpath("library", "cross_section.md"),
"Function index" => joinpath("library", "function_index.md"),
],
"refs.md",
]
Expand All @@ -82,7 +89,7 @@ try
Literate.markdown(file, tutorial_output_dir; documenter=true)
end

# geneate docs with Documenter.jl
# generate docs with Documenter.jl
makedocs(;
modules=[QEDbase],
checkdocs=:exports,
Expand Down
10 changes: 2 additions & 8 deletions docs/src/phase_space_point.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,5 @@ For any given process, we need a way to:
number and type of particles, momentum conservation).
- Access the momenta of individual particles or compute derived quantities.

In [this tutorial], we show how to create and use an `ExamplePhaseSpacePoint`,
following the interface specification given by [`AbstractPhaseSpacePoint']. We'll be using
particles and momenta from libraries like `QEDcore` and `QEDprocesses`, focusing on the
electron-positron annihilation process.

## Reference implementation

TBW
In [this tutorial](@ref tutorial_psp), we show how to create and use an `ExamplePhaseSpacePoint`,
following the interface specification given by [`AbstractPhaseSpacePoint`](@ref).
4 changes: 1 addition & 3 deletions docs/src/tutorial/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@

# First we need particle definitions from the particles tutorial:

#!format: off
redirect_stdout(devnull) do # hide
include(joinpath(dirname(Base.active_project()), "src", "tutorial", "particle.jl")) # to get predefined particles
end # hide
#!format: on

struct CustomModel <: AbstractModelDefinition end

Expand All @@ -27,7 +25,7 @@ function QEDbase.out_phase_space_dimension(proc::AbstractProcessDefinition, ::Cu
return 3 * number_outgoing_particles(proc) - 4
end

# The [`isphysical`](@ref) function should return whether the given process is physical in this model.
# The [`isphysical`](@extref QEDprocesses.isphysical) function should return whether the given process is physical in this model.
# For the electromagnetic interaction this means the fermion and anti-fermions need to match up.

function isphysical(proc::AbstractProcessDefinition, ::CustomModel)
Expand Down
10 changes: 4 additions & 6 deletions docs/src/tutorial/particle_stateful.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ end
#
# We can now create instances of `ExampleParticleStateful` for, say, `Muon` and `AntiMuon`.

#!format: off
redirect_stdout(devnull) do # hide
include(joinpath(dirname(Base.active_project()), "src", "tutorial", "particle.jl")) # to get predefined particles
include(joinpath(dirname(Base.active_project()), "src", "tutorial", "four_momentum.jl")) # to get custom four momentum vector
include(joinpath(dirname(Base.active_project()), "src", "tutorial", "particle.jl")) # to get predefined particles
include(joinpath(dirname(Base.active_project()), "src", "tutorial", "four_momentum.jl")) # to get custom four momentum vector
end # hide
#!format: on

# Create a four-momentum vector (dummy example)
momentum_muon = CustomFourMomentum(1.0, 0.0, 0.0, 0.0); # E, px, py, pz
Expand All @@ -86,8 +84,8 @@ println("Outgoing antimuon momentum: ", momentum(outgoing_antimuon))
# ## Summary
#
# In this tutorial, we created a general `ExampleParticleStateful` type that can represent any particle species
# (like `Muon` or `AntiMuon` implemented in [this tutorial](@ref tutorial_particle), but also `Electron` and
# `Positron` from `QEDcore`) by using the species as a type parameter. This approach avoids the need to define
# (like `Muon` or `AntiMuon` implemented in [this tutorial](@ref tutorial_particle), but also [`Electron`](@extref QEDcore.Electron) and
# [`Positron`](@extref QEDcore.Positron) from `QEDcore`) by using the species as a type parameter. This approach avoids the need to define
# separate stateful types for each particle, making the implementation more flexible and reusable.
#
# The key steps were:
Expand Down
4 changes: 1 addition & 3 deletions docs/src/tutorial/phase_space_point.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# # Define a Custom Phase Space Point
# # [Tutorial: Define a Custom Phase Space Point](@id tutorial_psp)
#
# In this tutorial, we will define a custom **phase space point** type following the interface
# specification used in `QuantumElectrodynamics.jl`.
Expand All @@ -21,12 +21,10 @@

using QEDbase

#!format: off
redirect_stdout(devnull) do # hide
include(joinpath(dirname(Base.active_project()), "src", "tutorial", "particle.jl")) # to get predefined particles
include(joinpath(dirname(Base.active_project()), "src", "tutorial", "particle_stateful.jl")) # to get custom particle stateful definition
end # hide
#!format: on

# We'll also need a `Photon` type which we briefly define right here.

Expand Down
2 changes: 0 additions & 2 deletions docs/src/tutorial/process.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@

using QEDbase

#!format: off
redirect_stdout(devnull) do # hide
include(joinpath(dirname(Base.active_project()), "src", "tutorial", "particle.jl")) # to get predefined particles
include(joinpath(dirname(Base.active_project()), "src", "tutorial", "model.jl")) # to get the custom model
include(joinpath(dirname(Base.active_project()), "src", "tutorial", "four_momentum.jl")) # to get the custom four momenta
include(joinpath(dirname(Base.active_project()), "src", "tutorial", "phase_space_point.jl")) # to get the custom phase space points
end # hide
#!format: on

# Define a specific process by creating a subtype of `AbstractProcessDefinition`:
struct MyProcess <: AbstractProcessDefinition
Expand Down

0 comments on commit 6913853

Please sign in to comment.