def __init__(self,M1,M2,P,ecc=<NUM_LIT:0>,n=None,<EOL>mean_anomaly=None,obsx=None,obsy=None,obsz=None,<EOL>obspos=None):
if type(M1) != Quantity:<EOL><INDENT>M1 = Quantity(M1, unit='<STR_LIT>')<EOL><DEDENT>if type(M2) != Quantity:<EOL><INDENT>M2 = Quantity(M2, unit='<STR_LIT>')<EOL><DEDENT>if type(P) != Quantity:<EOL><INDENT>P = Quantity(P, unit='<STR_LIT>')<EOL><DEDENT>if n is None:<EOL><INDENT>if M2.size==<NUM_LIT:1>:<EOL><INDENT>n = P.size<EOL><DEDENT>else:<EOL><INDENT>n = M2.size<EOL><DEDENT><DEDENT>self.M1 = M1<EOL>self.M2 = M2<EOL>self.N = n<EOL>self.P = P<EOL>if np.size(ecc) == <NUM_LIT:1>:<EOL><INDENT>ecc = np.ones(n)*ecc<EOL><DEDENT>self.ecc = ecc<EOL>mred = M1*M2/(M1+M2)<EOL>self.semimajor = semimajor(P,mred)   <EOL>self.mred = mred<EOL>if mean_anomaly is None:<EOL><INDENT>M = rand.uniform(<NUM_LIT:0>,<NUM_LIT:2>*np.pi,size=n)<EOL><DEDENT>else:<EOL><INDENT>M = mean_anomaly<EOL><DEDENT>self.M = M<EOL>if obspos is None:<EOL><INDENT>if obsx is None:<EOL><INDENT>self.obspos = random_spherepos(n)<EOL><DEDENT>else:<EOL><INDENT>self.obspos = SkyCoord(obsx,obsy,obsz,representation='<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.obspos = obspos<EOL><DEDENT>position,velocity = orbit_posvel(self.M,self.ecc,self.semimajor.value,<EOL>self.mred.value,<EOL>self.obspos)<EOL>self.position = position<EOL>self.velocity = velocity<EOL>
Population of orbits.

        Parameters
        ----------
        M1, M2 : float or array_like, or ``Quantity``
            Primary and secondary masses (if not ``Quantity``, assumed to be in solar masses)

        P : float or array_like, or ``Quantity``
            Orbital periods (if not ``Quantity``, assumed to be in days)

        ecc : float or array_like, optional
            Eccentricities.

        n : int, optional
            Number of instances to simulate.  If not provided, then this number
            will be the length of M2s (or Ps) provided.

        mean_anomaly : float or array_like, optional
            Mean anomalies of orbits.  Usually this will just be set randomly,
            but can be provided to initialize a particular state (e.g., when
            restoring an ``OrbitPopulation`` object from a saved state).

        obsx, obsy, obsz : float or array_like, optional
            "Observer" positions to define coordinates.  Will be set randomly
            if not provided.

        obspos : ``SkyCoord`` object, optional
            "Observer" positions may be set with a ``SkyCoord`` object (replaces
            obsx, obsy, obsz)