Closed jmeyers314 closed 2 years ago
Sounds good. I wouldn't make a new class for this though. These can be methods of BaseDeviate I think.
I thought about that. The only awkward part is that then UniformDeviate
will have an inherited method .poisson
and so on. Maybe that's fine though.
Doesn't bother me. :) But either way. If you prefer to make a new subclass of BaseDeviate that would enable these various driver methods, that's also fine.
Done via #1179
In numpy, if I want a random array uniformly distributed between -0.6 and +0.6 with 100 elements, I'd write:
Using GalSim deviates, I'd do something like:
I find the former easier to read. I don't think it'd be too difficult to create an object based on GalSim deviates with methods like
.uniform
,.normal
=.gaussian
,.binomial
,.poisson
, etc that have the same syntax as numpy. Making a drop-in replacement also means that it's easier for external packages (e.g., imsim, batoid, ...) to switch from numpy random numbers to Galsim random numbers with their stronger guarantee of stability over time.