Skip to content
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

[WIP] Pretty printing #60

Merged
merged 5 commits into from
May 21, 2024
Merged

Conversation

AntonReinhard
Copy link
Member

Adds pretty printing for:

  • PerturbativeQED model
  • Compton process
  • Coordinate systems, frames of reference, and phase space definition
  • Particle stateful
  • PhaseSpacePoint

Essentially, adding similar functionality to QEDjl-project/QEDbase.jl#61 for the QEDprocesses types.

I'm using the jldoctests to test, I'm not sure if it's really necessary to test in a separate test as well. Putting single jldoctests for these prints in every type definition would clutter the documentation a bit so I've not done that. If we really want tests for each show() we should probably do it in a test file.

Also, I'm not sure if there's a better way for the print functions than alternating the show for objects and print for strings. Interpolating doesn't work unless we also overload the print. (I think it is print, the number of string output related functions in Julia is confusing)

@AntonReinhard AntonReinhard requested a review from szabo137 May 16, 2024 20:37
Copy link
Member

@szabo137 szabo137 left a comment

Choose a reason for hiding this comment

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

There are some suggestions from my side, which we should discuss. I change the status of this PR to draft for the discussion, such that it is not accidentally merged.

docs/Project.toml Show resolved Hide resolved
src/phase_spaces.jl Outdated Show resolved Hide resolved
src/phase_spaces.jl Show resolved Hide resolved
src/phase_spaces.jl Show resolved Hide resolved
src/processes/one_photon_compton/process.jl Outdated Show resolved Hide resolved
@szabo137 szabo137 added this to the Release-next milestone May 17, 2024
@AntonReinhard AntonReinhard changed the title Pretty printing [WIP] Pretty printing May 17, 2024
@AntonReinhard
Copy link
Member Author

@szabo137 Please have a look again. I reworked the printing and implemented the MIME... overloads only for those that need multi-line printing, otherwise just the two-argument show(). That means that I should probably rework the printing for the QEDbase types (Incoming() etc.) in the same way, as I have done in the QEDbase_patch.jl now.

I've also removed most of the jldoctests and only kept the ones that I think add actual value for the documentation, showing an example construction of a ParticleStateful and a PhaseSpacePoint.

Copy link
Member

@szabo137 szabo137 left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks again for this, I like the look and feel now :-)

@szabo137 szabo137 merged commit 0491353 into QEDjl-project:dev May 21, 2024
4 checks passed
AntonReinhard added a commit to QEDjl-project/QEDbase.jl that referenced this pull request May 27, 2024
As discussed in QEDjl-project/QEDprocesses.jl#60
the pretty printing should overload the 2 argument versions of
`Base.show` instead of the 3 argument versions. This PR fixes that for
QEDbase.jl
@szabo137 szabo137 added the 05 - Enhancement Improvements of existing code label Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
05 - Enhancement Improvements of existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants