You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lasy is failing to read back a laser file (created by lasy itself) in rt geometry.
Check this piece of code based on one of the tutorials
fromlasy.laserimportLaserfromlasy.profiles.gaussian_profileimportGaussianProfilefromlasy.profiles.from_openpmd_profileimportFromOpenPMDProfilewavelength=800e-9# Laser wavelength in meterspolarization= (1, 0) # Linearly polarized in the x directionenergy=1.5# Energy of the laser pulse in joulesspot_size=25e-6# Waist of the laser pulse in meterspulse_duration=30e-15# Pulse duration of the laser in secondst_peak=0.0# Location of the peak of the laser pulse in timelaser_profile=GaussianProfile(
wavelength, polarization, energy, spot_size, pulse_duration, t_peak
)
dimensions="rt"# Use cylindrical geometrylo= (0, -2.5*pulse_duration) # Lower bounds of the simulation boxhi= (5*spot_size, 2.5*pulse_duration) # Upper bounds of the simulation boxnum_points= (300, 500) # Number of points in each dimensionlaser=Laser(dimensions, lo, hi, num_points, laser_profile)
file_prefix="test_output"# The file name will start with this prefixfile_format="h5"# Format to be used for the output filelaser.write_to_file(file_prefix, file_format, write_dir='.')
lasy_profile=FromOpenPMDProfile(
path='.',
iteration=0,
pol=(1, 0),
field='laserEnvelope',
prefix=file_prefix,
theta=0,
)
which fails when reading back the file, throwing this error:
ValueError: There are 300 points and 1 values in dimension 0
The reason why it fails is that RegularGridInterpolator is waiting a 2d array, but a 3d one is passed.
This comes from adding the azimuthal dimension to the read field in here:
In principle, one would have to make the combined_field_interp to account for the different azimuthal modes.
However, in the way the field is read at the moment in FromOpenPMDProfile, the azimuthal dimension will always have just one element.
So, for now, a quick workaround would be to take only the first (and only) mode.
Lasy is failing to read back a laser file (created by lasy itself) in
rt
geometry.Check this piece of code based on one of the tutorials
which fails when reading back the file, throwing this error:
ValueError: There are 300 points and 1 values in dimension 0
I have tracked the error to this line:
lasy/lasy/profiles/from_array_profile.py
Line 85 in b7f5aa9
The reason why it fails is that
RegularGridInterpolator
is waiting a 2d array, but a 3d one is passed.This comes from adding the azimuthal dimension to the read field in here:
lasy/lasy/profiles/from_openpmd_profile.py
Line 103 in b7f5aa9
In principle, one would have to make the
combined_field_interp
to account for the different azimuthal modes.However, in the way the field is read at the moment in
FromOpenPMDProfile
, the azimuthal dimension will always have just one element.So, for now, a quick workaround would be to take only the first (and only) mode.
See here -> PR #344
The text was updated successfully, but these errors were encountered: