Skip to content

Commit 5bc992d

Browse files
author
Uwe Hernandez Acosta
committed
updated readme, added example
1 parent cf892a6 commit 5bc992d

File tree

1 file changed

+46
-11
lines changed

1 file changed

+46
-11
lines changed

README.md

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,59 @@
1-
# LorentzVectorBase
2-
3-
Base interfaces for four-momenta in high-energy physics.
1+
# LorentzVectorBase.jl
42

53
[![Stable Documentation](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaHEP.github.io/LorentzVectorBase.jl/stable/)
64
[![In development documentation](https://img.shields.io/badge/docs-dev-blue.svg)](https://JuliaHEP.github.io/LorentzVectorBase.jl/dev/)
75
[![Test workflow status](https://github.com/JuliaHEP/LorentzVectorBase.jl/actions/workflows/Test.yml/badge.svg?branch=main)](https://github.com/JuliaHEP/LorentzVectorBase.jl/actions/workflows/Test.yml?query=branch%3Amain)
86
[![Docs workflow Status](https://github.com/JuliaHEP/LorentzVectorBase.jl/actions/workflows/Docs.yml/badge.svg?branch=main)](https://github.com/JuliaHEP/LorentzVectorBase.jl/actions/workflows/Docs.yml?query=branch%3Amain)
97
[![Coverage](https://codecov.io/gh/JuliaHEP/LorentzVectorBase.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/JuliaHEP/LorentzVectorBase.jl)
108

11-
# Code Formatting
9+
**LorentzVectorBase.jl** provides base interfaces for four-momenta in high-energy physics, facilitating standardized representations and operations on Lorentz vectors.
10+
11+
## Installation
12+
13+
Install the package using Julia's package manager:
14+
15+
```julia
16+
using Pkg
17+
Pkg.add("LorentzVectorBase")
18+
```
19+
20+
## Usage
21+
22+
This package defines abstract interfaces for Lorentz vectors. To utilize concrete implementations, consider packages like [LorentzVectorHEP.jl](https://github.com/JuliaHEP/LorentzVectorHEP.jl) or [FourVectors.jl](https://github.com/mmikhasenko/FourVectors.jl).
23+
24+
## Example
1225

13-
This package follows a standardized formatting configuration to ensure consistency across
14-
the codebase. We enforce these formatting guidelines by running checks on all pull requests
15-
through continuous integration (CI).
26+
Here is an example of how to define a custom Lorentz vector type and implement the required interface functions:
1627

17-
To format your code locally and ensure it meets the required standards, you can run the
18-
following command in your terminal:
28+
```Julia
29+
struct CustomLVector
30+
x
31+
y
32+
z
33+
t
34+
end
1935

20-
```bash
36+
LorentzVectorBase.coordinate_system(::CustomLVector) = LorentzVectorBase.XYZT()
37+
LorentzVectorBase.x(lv::CustomLVector) = lv.x
38+
LorentzVectorBase.y(lv::CustomLVector) = lv.y
39+
LorentzVectorBase.z(lv::CustomLVector) = lv.z
40+
LorentzVectorBase.t(lv::CustomLVector) = lv.t
41+
42+
43+
c = CustomLVector(1,2,3,4)
44+
@assert isapprox(LorentzVectorBase.spatial_magnitude(c), sqrt(1^2 + 2^2 + 3^2))
45+
```
46+
47+
## Code Formatting
48+
49+
To maintain code consistency, format your code with:
50+
51+
```julia
2152
julia --project=.formatting -e 'using Pkg; Pkg.instantiate(); include(".formatting/format_all.jl")'
2253
```
2354

24-
This will apply the necessary formatting rules to your code before submission.
55+
This ensures adherence to the project's formatting standards.
56+
57+
## License
58+
59+
This project is licensed under the MIT License.

0 commit comments

Comments
 (0)