Estimate a distribution and lifetime of star in the Galaxy.
Project description
ohirstar_scaleheight_lifetime
This ohirstar_scaleheight_lifetime module helps you estimate a plausible scale height and lifetime of stars.
The code was written during the investigation of the OH/IR stars distribution in the Galaxy (Uno et al. 2020).
See the jupyternotebook (named as "OHIR-statistics.ipynb") for the detail of statistical analysis.
Requirements
The code was implemented on python3.7 and it uses the following python liblalies.
- numpy
- matplotlib
- scipy
- pylab
Setup
package installation
pip install git+https://github.com/yuriuno/ohirstar_scaleheight_lifetime.git
Data analysis
1. Scale height
1.1 Construct a simple Galactic disk model
import numpy as np
import matplotlib.pyplot as plt
from pylab import rcParams
from mpl_toolkits.mplot3d import Axes3D
from scipy import stats
import ohirstar_scaleheight_lifeitme.ohirstar_scaleheight_lifetme as sl
sh = sl.ScaleHeight()
NUMBER = 3990
SCALE_LENGTH = 22 # kpc *exponential disk model
SCALE_HEIGHT = 0.15 # kpc *gaussian (simplified sech z^2 disk model)
DIST_FUNC = {'scale_length':SCALE_LENGTH, 'scale_height':SCALE_HEIGHT}
KINE_DIST = 'near' # 'near' or 'far' * luminosity function based on near/far kinematic distance
DETECTION_LIM = 0.122 # Jy *SPLASH detection limit is 0.065 * 3 sigma
mxyz, mlb, mflux = sh.model(DIST_FUNC, NUMBER, KINE_DIST)
1.2 Evaluate your model using K-S test
DATA = np.load('./data/stat') # datatype: numpy strings
# DATA format: name, longitude, latitude, radial-velocity, expansion-velocity, velocity-uncertainity, flux-density, size, spot_num
REGION = [{'l':[-28, -4], 'b':[-1.25, 1.25]},{'l':[4, 10], 'b':[-1.25,1.25]}, {'l':[14.35, 67.25], 'b':[-1.25,1.25]}] # specify the feild where you are evaluating
# dlb: np.array([l,b])
dlb = np.array([[float(i) for i in DATA[1]],[float(i) for i in DATA[2]]])
p_value = sh.pvalue(dlb, mlb, mflux, DETECTION_LIM, REGION)
print(format(p_value,'.3f'))
>>> '0.531'
1.3 Quick visualization of the constructed model.
# 3D(X,Y,Z) [kpc]
sh.visualize(mxyz, mflux)
# 2D(l,b) [deg]
sh.visualize(mlb, mflux)
2. Lifetime
2.1 A most plausible lifetime
Lifetime of transient phenomenon such as the duration of OH masers associated with evolved stars
can be estimated by consideing the probability
of detecting m dissapeared maser sources in n samples in
a given amount of time; dT as demonstrated by Engels and Jimenes-Esteban (2007).
For example if you have m=3 maser sources vanished in n=100 samples after dT=10 years, you will get the most prausible lifetime ~300 years.
import numpy as np
from scipy.special import comb
import ohirstar_scaleheight_lifetime.ohirstar_scaleheight_lifetime as sl
M = 30
N = 445
DT = 20
SPAN = 1000
lt = sl.LifeTime(M,N,DT,SPAN)
lifetime = lt.lifetime()
print(format(lifetime,'.1f'))
>>> '296.7'
2.2 Upper limits of a lifetime
Meanwhile, the upper limit of OH maser lifetime
with different significance levels can be estimated as follows
.
The upper limits for lifeitme of OH masers assuming at least m=3 maser sources vanish in
n=100 samples in dT=10 years will be 505, 1258, 2000 years depending on significance levels (1, 2, 3σ).
lifetime_upper_limit = lt.upper_limit()
print(lifetime_upper_limit)
>>> [326.90000000000435, 411.90000000000555, 512.900000000007] # 1 sigma, 2 sigma, 3 sigma
2.3 Quick visualization of the probability distribution
# Pnm
xscale = 'linear'
type = 'lifetime'
lt.visualize(xscale,type)
# Qnm
xscale = 'linear'
type = 'upper_limit'
lt.visualize(xscale,type)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ohirstar_scaleheight_lifetime-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ohirstar_scaleheight_lifetime-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f923864171903d2575df2e8f8209adef2e78b275cc49c29ef1c533177ae696c
|
|
| MD5 |
55b666c74de186bd95cb15825263372e
|
|
| BLAKE2b-256 |
f9054079ad8c39bf44af72d170d393774ef3bf6bdbd2de91639e3c1634272f1b
|