Skip to main content

A package to read SPARC data for Galactic Rotation Curves

Project description

pygrc

License publish test PyPI Package latest release

Author

Aman Desai

Description

A package to read SPARC data for Galactic Rotation Curves

Installation

pip install pygrc

Example Usage

    1. Import libraries
import math
import numpy as np
import matplotlib.pyplot as plt
import pygrc as gr
    1. Read Sparc Data
df = gr.Reader.read(filepath="/home/amdesai/Physics/data/NGC5055_rotmod.dat")
gr.Plot().overlap(df,"Rad",["Vobs","Vgas","Vbul","Vdisk"],"observed velocity")
df
    1. Some sample function
# mond and mass function are based on Galaxies 2018, 6(3), 70; https://doi.org/10.3390/galaxies6030070

def mass(r, M0, R0):
    return M0*(1- (1+(r/R0))*np.exp(-r/R0))

def mond(r, M0, rc, R0,b, beta):
    a = 1.2e-10
    G = 4.300e-6 #parsecs
    m = mass(r,M0, R0)
    f = (G*m/r)*(1 + b*(1+(r/rc)))#*10e-3
    return np.sqrt(f)*10e-3

def newton(r, M0, rc, R0,beta):
    a = 1.2e-10
    G = 4.30e-6 #parsecs
    m = mass(r,M0, R0)
    f = G*m/r
    #f = (G*m/r)*(1/np.sqrt(2)) * np.sqrt(1 + np.sqrt(1 + (r**4) * (2*a/(G*m))**2))
    return np.sqrt(f)*10e-3
  • 4a. Perform fit (uses iminuit in the background)
r = np.linspace(1e-5,df['Rad'].max(),2000)

m_1=gr.Fit(df['Rad'],df['Vobs'],1.,1.,3,.35,1.)

m_2=gr.Fit(df['Rad'],df['Vobs'],1.,1.,3,1.)
  • 4b. Continue:
m1= m_1.fit_lsq(mond, [(1.,1e17),(1.,10.),(2.,5.),(0.1,2),(0.1,2)],df['errV'],[False,False,True,True,True])
m1
  • 4c. Continue:
m2 = m_2.fit_lsq(newton, [(1.,1e16),(1.,10.),(1,10),(0.1,2)],df['errV'],[False,True,True,True])
m2
  • 5a. draw plots
m_2.get_profile(m2,'M0')
m_1.draw_contours(m1,['M0','rc'])
  • 6b.
fig, ax =plt.subplots()
gr.Plot().plot_grc(df,m1,mond,'MOND','NGC',ax)
gr.Plot().plot_grc(df,m2,newton,'Newton','NGC',ax)
plt.savefig('1.pdf')

References:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygrc-0.2.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

pygrc-0.2.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file pygrc-0.2.0.tar.gz.

File metadata

  • Download URL: pygrc-0.2.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for pygrc-0.2.0.tar.gz
Algorithm Hash digest
SHA256 23a8786b97e41171c3e48065d661ab3b0a19f8e84171fd36e9964417c24b5ee0
MD5 36ea8c53cb5528edf6a8a33e6f0b4dff
BLAKE2b-256 30c49dc6602887e73b34347faa43a8ea003d4fec55b780fda76c21589ffa9410

See more details on using hashes here.

File details

Details for the file pygrc-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pygrc-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for pygrc-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ace273f312881e96365eff06ff3e96765d659d9db1aa48ea6ee6d4be73f9da5
MD5 e3cc4561e936eb64d3ab9552419403df
BLAKE2b-256 797e5aaf750f9cb44437eabf5722d478da473c7a348d2af22637a7fa03ae9f2f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page