Skip to content

Break up eventgen module

Chris Pankow requested to merge eventgen_breakdown into master

Breaks eventgen.py into modules: eventgen/__init__.py, distributions.py, io.py, transforms.py. To wit:

# grep class __init__.py 
# Event classes
class Event(object):
# EventGenerator classes
class EventGenerator(object):
class MonteCarloIntegrator(EventGenerator):
# grep class distributions.py
class SamplingDistribution(object):
        raise NotImplementedError('child classes should override this')
        raise NotImplementedError('child classes should override this')
        raise NotImplementedError('child classes should override this')
        raise NotImplementedError('child classes should override this')
class TimeDistribution(SamplingDistribution):
    """a child class used to declare things are distributions over time
class EccentricityDistribution(SamplingDistribution):
    """a child class used to declar things are distributions over eccentricity
class OrientationDistribution(SamplingDistribution):
    """a child class used to delcare things are distributions over orientation
class DistanceDistribution(SamplingDistribution):
    """a child class used to declare things are distance distributions
class RedshiftDistribution(SamplingDistribution):
    """a child class used to declare things are redshift distributions
class MassDistribution(SamplingDistribution):
    """a child class used to declare things are mass distributions
class SpinDistribution(SamplingDistribution):
    """a child class used to declare things are spin distributions
class UniformEventTime(TimeDistribution):
class ZeroEccentricity(EccentricityDistribution):
class RandomOrientation(OrientationDistribution):
class OptimallyOriented(OrientationDistribution):
class MadauDickinsonRedshift(RedshiftDistribution):
class UniformLogRedshift(RedshiftDistribution):
class ParetoRedshift(RedshiftDistribution):
class UniformRedshift(RedshiftDistribution):
class UniformComovingRedshift(RedshiftDistribution):
class UniformVolumeDistance(DistanceDistribution):
class UniformComovingDistance(DistanceDistribution):
class FixedComponentMass(MassDistribution):
class UniformComponentMass(MassDistribution):
class NormalComponentMass(MassDistribution):
class AstroComponentMass(MassDistribution):
class ParetoFlatComponentMass(MassDistribution):
class ZeroSpin(SpinDistribution):
class UniformSpin(SpinDistribution):
class UniformAlignedSpin(SpinDistribution):
class IsotropicSpin(SpinDistribution):
class IsotropicAlignedSpin(SpinDistribution):
# grep class transforms.py 
class AttributeTransformation(object):
    """a simple class that transforms Event attributes and add them to the object in place
class Celestial2Geographic(AttributeTransformation):
class Redshift2ComovingDistance(AttributeTransformation):
class Redshift2LuminosityDistance(AttributeTransformation):
class LuminosityDistance2Redshift(AttributeTransformation):
class ComponentMass2MchirpEta(AttributeTransformation):
class ComponentMass2q(AttributeTransformation):
class SourceMass2DetectorMass(AttributeTransformation):
class Spins2Chi(AttributeTransformation):
class Spins2ConstantSpinParams(AttributeTransformation):
class SNR(AttributeTransformation):
class Pdet(SNR):
# grep "^def" io.py
def tmppath(path):
def move(source, target):
def _events2array(events, attrs):
def events2csv(events, attrs, path, delimiter=','):
def csv2events(path, delimiter=','):
def events2xml(events, attrs, path):
def xml2events(path):
def events2hdf5(events, attrs, path, root=None, meta=None):
def hdf52events(path, root=None):
def events2dataframe(events, attrs):

All the submodules are imported into __init__.py.

Edited by Chris Pankow

Merge request reports

Loading