procastro.astro package
Subpackages
Submodules
procastro.astro.astro module
- procastro.astro.astro.applyfilter(name, spectra, wav_freq=None, n_wav_bb=100, output_unit=None, filter_dir=None, full=False)
Apply filter to spectra. It can be given or blackbody
- Parameters:
name (str) – Filter name
spectra (array_like or float) – Either flux (if iterable) or temperature (if scalar) for blackbody
wav_freq (array_like, optional) – Wavelength or frequency. Only necessary when flux is given as spectra
n_wav_bb (int, optional) – Number of wavelength points for blackbody. Default is 100
filter_unit (astropy.unit, optional) – If None use getfilter’s default
output_unit (astropy.unit, optional) – Default unit for output. Default is nanometers
filter_dir (str, optional) – If None use getfilter’s default
full (bool, optional) –
- If True, then return (filtered value, central weighted wavelength,
equivalent width)
- Return type:
float
- procastro.astro.astro.blackbody(temperature, wav_freq, unit=None)
Computes a blackbody curve for the parameters given
- Parameters:
temperature (astropy.unit) – Assumes kelvin if unit is not specified
wav_freq (astropy.unit) – Wavelength or frequency
unit (astropy.unit, optional) – unit for wav_freq from astropy.unit. If None and wav_freq is not an astropy.quantity, then assume microns
- Return type:
Blackbody curve at specified wavelength or frequency
- Raises:
ValueError – wav_frequency unit is invalid
- procastro.astro.astro.filter_conversion(target_filter, temperature, temperature_ref=9700, verbose=True, **kwargs)
Convert from one given filter (in kwargs) to a target_filter
- Parameters:
target_filter (str) – Target filter for the conversion
temperature (int) – Temperature of star
temperature_ref (int, optional) – Temperature of magnitude’s zero-point
verbose (boolean, optional) – Write out the conversion
kwargs (dict) – It should have one element: filter=value, as the original filter. Any dot (.) in filter will be converted to ‘_’ before passing it to get_filter.
- Returns:
Converted value assuming a blackbody
- Return type:
float
- procastro.astro.astro.find_target(target, coo_files=None, return_pm=False, equinox='J2000', extra_info=None, verbose=False)
Obtain coordinates from a target, that can be specified in various formats.
- Parameters:
target (str) – Either a coordinate understandable by astropy.coordinates (RA in hours, Dec in degrees), a name in coo_files, or a name resolvable by Simbad. Tests strictly in the previous order, returns as soon as it finds a match.
coo_files (array_like, optional) – List of files that are searched for a match in target name. File should have at least three columns: Target_name RA Dec; optionally, a fourth column for comments. Target_name can have underscores that will be matched against spaces, dash, or no-character. Two underscores will additionally consider optional anything that follows (i.e. WASP_77__b, matches wasp-77, wasp77b, but not wasp77a). RA and Dec can be any mathematical expression that eval() can handle. RA is hms by default, unless ‘d’ is appended, Dec is always dms.
return_pm (bool, optional) – if True return proper motions. Only as provided by Simbad for now, otherwise returns None for each
equinox (str, optional) – Which astronomy equinox the coordinates refer. Default is J2000
- Returns:
RA and Dec in hours and degrees, respectively.
- Return type:
SkyCoord object
- Raises:
ValueError – If all query attempts fail (Wrong coordinates or unknown)
- procastro.astro.astro.get_transit_ephemeris(target, direc='/home/docs/checkouts/readthedocs.org/user_builds/procastro/checkouts/v0.0.13/procastro/astro')
Recovers epoch, period and length of a target transit if said transit has been specified in one of the provided paths
Transit files must be named “.transits” or “transits.txt”, each transit should have the following columns separated by a space:
{object_name} E{transit_epoch} P{transit_period} L{transit_length}
If the object name contain spaces, replace them with an underscore when writing it into the file. On the other hand querying a name with spaces requires using spaces.
An optional comment column can be placed at the end of a row placing a-mass ‘C’ as prefix.
- Parameters:
target (str) – Target requested
direc (str, optional) – Directory containing the files to be inspected
- Returns:
tr_epoch (float or None)
tr_period (float or None)
tr_length (float or None)
- Raises:
ValueError – If a data field does not match the specified format
- procastro.astro.astro.getfilter(name, name_only=False, filter_unit=None, fct=1, filter_dir='/home/inv/common/standards/filters/oth/*/', force_positive=True, force_increasing=True)
Get transmission curve for a particular filter
- Parameters:
name (str or array_like) – Name of the filter (filenames in directory). If array_like, then it needs to have two elements to define a uniform filter within the specified cut-in and cut-out values with value 1.0 and in a range 10% beyond with value 0.0, for a total of 50 pixels.
name_only (bool, optional) – If True returns the name of the file only
filter_unit (astropy quantity, optional) – Default filter unit that should be in files. Default is Angstroms. Can be specified in file as first line with comment ‘unit:’
fct (int, optional) – Factor by which the transmission is divided in the archive (i.e. 100 if it is written in percentage). Can be specified in file as first line with comment ‘fct:’. Default is 1
filter_dir (str, optional) – Directory that hold the filters, it accepts wildcards that will be used by glob. Default is
/home/inv/common/standards/filters/oth/*/force_positive (bool, optional) – Force positive values for transmission
force_increasing (bool, optional) – Sort such that wavelength is always increasing
- Returns:
Transmission curve
- Return type:
wavelength, transmission
- procastro.astro.astro.moon_distance(target, location=None, time=None)
Returns the distance of moon to target
- Parameters:
location (apcoo.EarthLocation) – If None uses CTIO observatory
time (apc.Time) – If None uses now().
- procastro.astro.astro.planeteff(au=1.0, tstar=6000, rstar=1.0, albedo=0.0)
Computes effective temperature of a planet based on the given parameters
- Parameters:
au (float, optional) –
tstar (int, optional) –
rstar (float, optional) –
albedo (float, optional) –
- Return type:
float
- procastro.astro.astro.read_horizons_cols(file)
Reads an horizons ephemeris file into a dictionary. It maintains the original column’s header as dictionary keys. Columns can be automatically recognized as float or int (work in progress the latter)
- Parameters:
file (str) –
- Return type:
dict
procastro.astro.moon module
- procastro.astro.moon.add_label(text, to_earth, azimuth, offset_label=-200, ha='left', va='center', **kwargs)
- procastro.astro.moon.add_label_xy(text, xyz, offset_label, **kwargs)
- procastro.astro.moon.plot_parallactic_angle(time, span, delta, correction_deg=30)
- procastro.astro.moon.shadow(delta, azimuth, **kwargs)
- procastro.astro.moon.sub_earth_n_position_angle(body)
- procastro.astro.moon.xyz_from_sidereal(skycoord)