samoylv / WPG

WPG: WavePropaGator, Interactive framework for X-ray FEL optics design and simulations.
Other
26 stars 20 forks source link

CRL disp calc fails with Py2 #92

Open samoylv opened 7 years ago

samoylv commented 7 years ago

calculation CRL with dispersion under Py 2.7

this line brings TypeError: only length-1 arrays can be converted to Python scalars

buzmakov commented 7 years ago

Could you please provide simple test to reproduce this error?

On Tue, Oct 18, 2016 at 1:02 PM, samoylv notifications@github.com wrote:

calculation CRL with dispersion under Py 2.7

this line https://github.com/samoylv/WPG/blob/feature/srw_update/wpg/srwlib.py#L2836 brings TypeError: only length-1 arrays can be converted to Python scalars

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/samoylv/WPG/issues/92, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6Pt1Y2qvBafkdNXHpTPBFcJWdtee6Pks5q1JkpgaJpZM4KZmV4 .

samoylv commented 7 years ago

tutorial3_beamline_focusing_CRL_disp.ipynb, running on Py 2.7 in cell 12

samoylv commented 7 years ago

BTW, numpy.exp() in srwlib.py does not help

buzmakov commented 7 years ago

We should pass parameters for srwl_opt_setup_CRL as list

crl_delta = list(be_data[:,1])  # Dummy numbers)
crl_attenuation_length  = list(be_data[:,2]) #Dummy numbers)

May be we should check it in our wrapper createCRL....

samoylv commented 7 years ago

good point. it was also fix from @CFGrote #80 - is that the same issue?

samoylv commented 7 years ago

@buzmakov fixed?