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

Gaussian source #180

Open
CFGrote opened this issue Feb 9, 2020 · 4 comments
Open

Gaussian source #180

CFGrote opened this issue Feb 9, 2020 · 4 comments
Assignees

Comments

@CFGrote
Copy link
Collaborator

CFGrote commented Feb 9, 2020

Make a Calculator that generates a wavefront with Gaussian amplitude distribution in time and space.

@CFGrote CFGrote self-assigned this Feb 9, 2020
@CFGrote
Copy link
Collaborator Author

CFGrote commented Feb 9, 2020

Pushed to
6a65415 on gauss_source.

@CFGrote CFGrote assigned CFGrote and unassigned CFGrote Feb 9, 2020
@JunCEEE
Copy link
Collaborator

JunCEEE commented Feb 10, 2020

When I try to run gaussianSource = GaussianPhotonSource(), I got this error:

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-4-b3a32f0e7291> in <module>
----> 1 gaussianSource = GaussianPhotonSource()

/gpfs/exfel/data/user/juncheng/panoscProject/src/simex_platform/Sources/python/SimEx/Calculators/GaussianPhotonSource.py in __init__(self, parameters, input_path, output_path)
     50 
     51         # Initialize base class.
---> 52         super(GaussianPhotonSource, self).__init__(parameters, input_path, output_path)
     53 
     54         self.parameters = parameters

/gpfs/exfel/data/user/juncheng/panoscProject/src/simex_platform/Sources/python/SimEx/Calculators/AbstractPhotonSource.py in __init__(self, parameters, input_path, output_path)
     54 
     55         # Init base class.
---> 56         super(AbstractPhotonSource, self).__init__(parameters, input_path, output_path)
     57 
     58         # Setup provided data groups and sets.

/gpfs/exfel/data/user/juncheng/panoscProject/src/simex_platform/Sources/python/SimEx/Calculators/AbstractBaseCalculator.py in __init__(self, parameters, input_path, output_path)
     52         self.__parameters = checkAndSetParameters(parameters)
     53 
---> 54         self.__input_path, self.__output_path = checkAndSetIO((input_path, output_path))
     55 
     56 

/gpfs/exfel/data/user/juncheng/panoscProject/src/simex_platform/Sources/python/SimEx/Calculators/AbstractBaseCalculator.py in checkAndSetIO(io)
    214     i = checkAndSetInstance(str, io[0])
    215     if i is None:
--> 216         raise IOError("The parameter 'input_path' must be a valid filename.")
    217     i = os.path.abspath(i)
    218 #

OSError: The parameter 'input_path' must be a valid filename.

@CFGrote
Copy link
Collaborator Author

CFGrote commented Mar 26, 2020

@ejcjason , is the above still an open issue? look at the tests for GaussianSource to see how it is supposed to work.

@JunCEEE
Copy link
Collaborator

JunCEEE commented Mar 26, 2020

develop branch Tested, still found several problems.

Cannot be imported by from SimEx import *

Got error NameError: name 'GaussWavefrontParameters' is not defined and
NameError: name 'GaussWavefrontParameters' is not defined.

Possible solution: init.py might need to be modified.

unnecessay input_path requirement of GaussianPhotonSource

A dummy input_path has to be placed for GaussianPhotonSource, which should not be needed.

No attribute 'divergence' found while running backengine

When running gaussianSource.backengine(), got AttributeError: 'GaussWavefrontParameters' object has no attribute 'divergence'

My test script

import SimEx
from SimEx import *

gaussianParam = GaussWavefrontParameters(
    photon_energy = 4972.0 * electronvolt,  # photon energy in eV
    beam_diameter_fwhm=1.3e-7 * meter,      # focus diameter in m
    pulse_energy=0.45e-3 * joule,           # pulse energy in J
    photon_energy_relative_bandwidth=0.003, # relative bandwidth dE/E
    divergence=0.0*radian,                         # Beam divergence in rad
    number_of_transverse_grid_points = 100,
    number_of_time_slices = 30,
    )
gaussianSource = GaussianPhotonSource(
    parameters= gaussianParam,
    input_path='fd',
    output_path = 'FELsource_out.h5')

#import pdb; pdb.set_trace()
gaussianSource.backengine()
gaussianSource.saveH5()

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

No branches or pull requests

2 participants