Star Utilities

The vespa.stars module provides several useful utilities in support of generating StarPopulation objects.

Extinction at Infinity

vespa.stars.extinction.get_AV_infinity(ra, dec, frame='icrs')[source]

Gets the A_V exctinction at infinity for a given line of sight.

Queries the NED database using curl.

Note

It would be desirable to rewrite this to avoid dependence on curl.

Parameters:
  • ra,dec – Desired coordinates, in degrees.
  • frame – (optional) Frame of input coordinates (e.g., 'icrs', 'galactic')

TRILEGAL Simulations

vespa.stars.trilegal.get_trilegal(filename, ra, dec, folder='.', galactic=False, filterset='kepler_2mass', area=1, maglim=27, binaries=False, trilegal_version='1.6', sigma_AV=0.1, convert_h5=True)[source]

Runs get_trilegal perl script; optionally saves output into .h5 file

Depends on a perl script provided by L. Girardi; calls the web form simulation, downloads the file, and (optionally) converts to HDF format.

Uses A_V at infinity from utils.get_AV_infinity().

Note

Would be desirable to re-write the get_trilegal script all in python.

Parameters:
  • filename – Desired output filename. If extension not provided, it will be added.
  • ra,dec – Coordinates (ecliptic) for line-of-sight simulation.
  • folder – (optional) Folder to which to save file. Acknowledged, file control in this function is a bit wonky.
  • filterset – (optional) Filter set for which to call TRILEGAL.
  • area – (optional) Area of TRILEGAL simulation [sq. deg]
  • maglim – (optional) Limiting magnitude in first mag (by default will be Kepler band) If want to limit in different band, then you have to got directly to the get_trilegal perl script.
  • binaries – (optional) Whether to have TRILEGAL include binary stars. Default False.
  • trilegal_version – (optional) Default '1.6'.
  • sigma_AV – (optional) Fractional spread in A_V along the line of sight.
  • convert_h5 – (optional) If true, text file downloaded from TRILEGAL will be converted into a pandas.DataFrame stored in an HDF file, with 'df' path.

Other Utility Functions

Here is a grab bag of stuff that gets used (or maybe doesn’t) when generating various StarPopulation objects.

vespa.stars.utils.addmags(*mags)[source]

“Adds” magnitudes. Yay astronomical units!

vespa.stars.utils.dfromdm(dm)[source]

Returns distance given distance modulus.

vespa.stars.utils.distancemodulus(d)[source]

Returns distance modulus given d in parsec.

vespa.stars.utils.draw_eccs(n, per=10, binsize=0.1, fuzz=0.05, maxecc=0.97)[source]

draws eccentricities appropriate to given periods, generated according to empirical data from Multiple Star Catalog

vespa.stars.utils.draw_msc_periods(n)[source]

Draw orbital periods according to Multiple Star Catalog

vespa.stars.utils.draw_pers_eccs(n, **kwargs)[source]

Draw random periods and eccentricities according to empirical survey data.

vespa.stars.utils.draw_raghavan_periods(n)[source]

Draw orbital periods according to Raghavan (2010)

vespa.stars.utils.fluxfrac(*mags)[source]

Returns fraction of total flux in first argument, assuming all are magnitudes.

vespa.stars.utils.mult_masses(mA, f_binary=0.4, f_triple=0.12, minmass=0.11, qmin=0.1, n=100000.0)[source]

Returns m1, m2, and m3 appropriate for TripleStarPopulation, given “primary” mass (most massive of system) and binary/triple fractions.

star with m1 orbits (m2 + m3). This means that the primary mass mA will correspond either to m1 or m2. Any mass set to 0 means that component does not exist.

vespa.stars.utils.rochelobe(q)[source]

returns r1/a; q = M1/M2

vespa.stars.utils.semimajor(P, mstar=1)[source]

Returns semimajor axis in AU given P in days, mstar in solar masses.

vespa.stars.utils.withinroche(semimajors, M1, R1, M2, R2)[source]

Returns boolean array that is True where two stars are within Roche lobe