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

update show function to include intensity #335

Open
wants to merge 9 commits into
base: development
Choose a base branch
from

Conversation

rob-shalloo
Copy link
Member

@rob-shalloo rob-shalloo commented Dec 19, 2024

Requires merging of #307 first

modified the existing show method of the laser class to scale the temporal and spatial axes to commonly used units (ns,ps,fs or um, mm, m).

Additionally, added a boolean to flag whether the user wants intensity plotted instead of amplitude. If Intensity is selected for plotting then spatial and temporal lineouts are also added together with simple measurements of the pulse duration and spot size. These measurements rely on functions included in #307

Example of use:

# Define the physical laser parameters
wavelength = 800e-9         # Laser wavelength in meters
polarization = (1, 0)       # Linearly polarized in the x direction
energy = 1.5                # Energy of the laser pulse in joules
spot_size = 25e-6           # Waist of the laser pulse in meters
pulse_duration = 30e-15     # Pulse duration of the laser in seconds
t_peak = 0.0                # Location of the peak of the laser pulse in time


# Create a laser profile which gathers all the physical properties of the laser
laser_profile = GaussianProfile(
    wavelength, polarization, energy, spot_size, pulse_duration, t_peak
)

# Evaluate the laser field on a computational grid
dimensions = "rt"                           # Use cylindrical geometry
lo = (0, -5 * pulse_duration)             # Lower bounds of the simulation box
hi = (5 * spot_size, 5 * pulse_duration)  # Upper bounds of the simulation box
num_points = (300, 500)                     # Number of points in each dimension

laser = Laser(dimensions, lo, hi, num_points, laser_profile)

show(laser,show_intensity=True)
Screenshot 2024-12-19 at 11 05 20

@rob-shalloo rob-shalloo changed the title [WIPupdate show function [WIP] update show function to include intensity Dec 19, 2024
@rob-shalloo rob-shalloo changed the title [WIP] update show function to include intensity update show function to include intensity Dec 20, 2024
@MaxThevenet
Copy link
Contributor

Thanks for this PR! Could the implementation be moved to utils somewhere to keep the Laser class simple and lean? I think the call show(laser,show_intensity=True) would work great.

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.

2 participants