-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
282048f
commit 7abc4a5
Showing
2 changed files
with
225 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "e7a1fc45", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import math\n", | ||
"import numpy as np\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"import pygrc as gr" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "7e27a301", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"df = gr.Reader.read(filepath=\"/home/amdesai/Physics/data/NGC5055_rotmod.dat\")\n", | ||
"gr.Plot().overlap(df,\"Rad\",[\"Vobs\",\"Vgas\",\"Vbul\",\"Vdisk\"],\"observed velocity\")\n", | ||
"df" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "642a96a4", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# some example functions based on Galaxies 2018, 6(3), 70; https://doi.org/10.3390/galaxies6030070\n", | ||
"\n", | ||
"def mass(r, M0, R0):\n", | ||
" return M0*(1- (1+(r/R0))*np.exp(-r/R0))\n", | ||
"\n", | ||
"def mond(r, M0, rc, R0,b, beta):\n", | ||
" a = 1.2e-10\n", | ||
" G = 4.300e-6 #parsecs \n", | ||
" m = mass(r,M0, R0)\n", | ||
" f = (G*m/r)*(1 + b*(1+(r/rc)))#*10e-3\n", | ||
" return np.sqrt(f)*10e-3\n", | ||
"\n", | ||
"def newton(r, M0, rc, R0,beta):\n", | ||
" a = 1.2e-10\n", | ||
" G = 4.30e-6 #parsecs \n", | ||
" m = mass(r,M0, R0)\n", | ||
" f = G*m/r\n", | ||
" #f = (G*m/r)*(1/np.sqrt(2)) * np.sqrt(1 + np.sqrt(1 + (r**4) * (2*a/(G*m))**2))\n", | ||
" return np.sqrt(f)*10e-3\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "6df730b3", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"r = np.linspace(1e-5,df['Rad'].max(),2000)\n", | ||
"\n", | ||
"m_1=gr.Fit(df['Rad'],df['Vobs'],1.,1.,3,.35,1.)\n", | ||
"\n", | ||
"m_2=gr.Fit(df['Rad'],df['Vobs'],1.,1.,3,1.)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "0deaae95", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"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])\n", | ||
"m1" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "64e5e876", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"m2 = m_2.fit_lsq(newton, [(1.,1e16),(1.,10.),(1,10),(0.1,2)],df['errV'],[False,True,True,True])\n", | ||
"m2" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "efb56302", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"m_2.get_profile(m2,'M0')\n", | ||
"m_1.draw_contours(m1,['M0','rc'])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "98ed80d2", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"fig, ax =plt.subplots()\n", | ||
"gr.Plot().plot_grc(df,m1,mond,'MOND','NGC',ax)\n", | ||
"gr.Plot().plot_grc(df,m2,newton,'Newton','NGC',ax)\n", | ||
"plt.savefig('1.pdf')" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |