Releases: skuschel/postpic
Releases · skuschel/postpic
v0.4
Highlights
- Improved interoperability with numpy:
Fieldnow understands most of numpy's broadcastingFieldcan be used as an argument to numpy's ufuncs.
- Import and export routines for
Fieldincuding vtk, compatible with paraview. - Coordinate mapping and transform for
Field. - Brand new
Multispecies.__call__interface: This takes an expression, which is evaluated bynumexr, increasing the speed of per-particle scalar computations strongly. It's also really user-friendly.
Incompatible adjustments to previous version
postpic.Fieldmethodexporttocsvis removed. Useexportinstead.postpic.Fieldmethodtransformis renamed tomap_coordinates, matching the underlying scipy-function.postpic.Fieldmethodmeanhas now an interface matchingndarray.mean. This means that, if theaxisargument is not given, it averages across all axes instead the last axis.postpic.Field.map_coordinatesapplies now the Jacobian determinant of the transformation, in order to preserve the definite integral.
In your code you will need to turn calls toField.transforminto calls toField.map_coordinatesand set the keyword argumentpreserve_integral=Falseto get the old behaviour.postpic.MultiSpecies.createFieldhas now keyword arguments (bins,shape), which replace the corresponding entries from theoptargshdictionary. The use of theoptargshkeyword argument has been deprecated.- The functions
MultiSpecies.compress,MultiSpecies.filter,MultiSpecies.uncompressandParticleHistory.skipreturn a new object now. Before this release, they modified the current object. Assumingmsis aMultiSpeciesobject, the corresponding adjustemens read:
old:ms.filter('gamma > 2')
new:ms = ms.filter('gamma > 2') plotter_matplotlibhas a new default symmetric colormap
Other improvements and new features
- Overload of the
~(invert) operator onpostpic.MultiSpecies. Ifmsis a MultiSpecies object with filtered particles (created by the use ofcompressorfilter), then~msinverts the selection of particles. postpic.Fieldhas methods.loadfromand.saveto. These can be used to save a Field to a.npzfile for later use. Use.loadfromto load a Field object from such a file. All attributes of the Field are restored.postpic.Fieldhas methods.exportand.import. These are used to export fields to and import fields from foreign file formats such as.csv,.vtk,.png,.tif,.jpg. It is not guaranteed to get all attributes back after.exporting and than.importing a Field. Some formats are not available for both methods.postpichas a new functiontime_profile_at_planethat 'measures' the temporal profile of a pulse while passing through a planepostpichas a new functionunstagger_fieldsthat will take a set of staggered fields and returns the fields after removing the staggerpostpichas a new functionexport_vector_vtkthat takes up to three fields and exports them as a vector field in the.vtkformatpostpichas a new functionexport_scalars_vtkthat takes up to four fields and exports them as multiple scalar fields on the same grid in the.vtkformatpostpic.Fieldworks now with all numpy ufuncs, also withufunc.reduce,ufunc.outer,ufunc.accumulateandufunc.atpostpic.Fieldnow supports broadcasting like numpy arrays, for binary operators as well as binary ufunc operationspostpic.Fieldhas methods.swapaxes,.transposeand properties.Tandndimcompatible to numpy.ndarraypostpic.Fieldhas methodsall,any,max,min,prod,sum,ptp,std,var,mean,clipcompatible to numpy.ndarraypostpic.Fieldhas a new methodmap_axis_gridfor transforming the coordinates only along one axis which is simpler thanmap_coordinates, but also takes care of the Jacobianpostpic.Fieldhas a new methodautocutoutused to slice away close-to-zero regions from the borderspostpic.Fieldhas a new methodfft_autopadused to pad a small number of grid points to each axis such that the dimensions of the Field are favourable to FFTWpostpic.Fieldhas a new methodadjust_stagger_toto adjust the grid origin to match the grid origin of another fieldpostpic.Fieldhas a new methodphaseto get the unwrapped phase of the fieldpostpic.Fieldhas a new methodderivativeto calculate the derivative of a fieldpostpic.Fieldhas new methodsflipandrot90similar tonp.flip()andnp.rot90()postpic.Field.topolarhas new defaults for extent and shapepostpic.Field.integratenow uses the simpson method by defaultpostpic.Field.integratenow has a new 'fast' method that uses numexpr, suitable for large datasets- New module
postpic.experimentalto contain experimental algorithms for your reference. These algorithms are not meant to be useable as-is, but may serve as recipes to write your own algorithms. - k-space reconstruction from EPOCH dumps has greatly improved accuracy due to a new algorithm correctly incorporating the frequency response of the implicit linear interpolation performed by EPOCH's half-steps
plotter_matplotlib.plotFieldallows to overrideaspectoption toimshow
v0.3.1
v0.3
v0.3
2017-09-28
Many improvements in terms of speed and features. Unfortunately some changes are not backwards-compatible to v0.2.3, so you may have to adapt your code to the new interface. For details, see the corresponding section below.
Highlights
- kspace reconstruction and propagation of EM waves.
postpic.Fieldproperly handles operator overloading and slicing. Slicing can be index based (integers) or referring the actual physical extent on the axis of a Field object (using floats).- Expression based interface to particle properties (see below)
Incompatible adjustments to last version
- New dependency: Postpic requires the
numexprpackage to be installed now. - Expression based interface of for particles: If
msis apostpic.MultiSpeciesobject, then the callms.X()has been deprecated. Usems('x')instead. This new particle interface can handle expressions that thenumexprpackage understands. Alsoms('sqrt(x**2 + gamma - id)')is valid. This interface is easier to use, has better functionality and is faster due tonumexpr.
The list of known per particle scalars and their definitions is available atpostpic.particle_scalars. In addition all constants ofscipy.constants.*can be used.
In case you find particle scalar that you use regularly which is not in the list, please open an issue and let us know! - The
postpic.Fieldclass now behaves more like annumpy.ndarraywhich means that almost all functions return a new field object instead of modifying the current. This change affects the following functions:half_resolution,autoreduce,cutout,mean.
Other improvements and new features
postpic.helper.kspacecan reconstruct the correct k-space from three EM fields provided to distinguish between forward and backward propagating waves (thanks to @Ablinne)postpic.helper.kspace_propagatewill turn the phases in k-space to propagate the EM-wave.- List of new functions in
postpicfrompostpic.helper(thanks to @Ablinne):kspace_epoch_like,kspace,kspace_propagate. Field.fftfunction for fft optimized with pyfftw (thanks to @Ablinne).Field.__getitem__to slice a Field object. If integers are provided, it will interpret them as gridpoints. If float are provided they are interpreted as the physical region of the data and slice along the corresponding axis positions (thanks to @Ablinne).Fieldclass has been massively impoved (thanks to @Ablinne): The operator overloading is now properly implemented and thanks to__array__method, it can be interpreted by numpy as an ndarray whenever neccessary.- List of new functions of the
Fieldclass (thanks to @Ablinne):meshgrid,conj,replace_data,pad,transform,squeeze,integrate,fft,shift_grid_by,__getitem__,__setitem__. - List of new properties of the
Fieldclass (thanks to @Ablinne):matrix,real,imag,angle. - Many performance optimizations using pyfftw library (optional) or numexpr (now required by postpic) or by avoiding in memory data copying.
- Lots of fixes