mirror of
https://asciireactor.com/otho/phy-4660.git
synced 2024-12-18 12:15:06 +00:00
302 lines
107 KiB
Plaintext
302 lines
107 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Populating the interactive namespace from numpy and matplotlib\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"%pylab inline\n",
|
||
|
"\n",
|
||
|
"from scipy.stats import norm\n",
|
||
|
"from scipy.stats import lognorm\n",
|
||
|
"from scipy.optimize import curve_fit\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 65,
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"[<matplotlib.lines.Line2D at 0x7fa4e0d4fc90>]"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 65,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgwAAAFkCAYAAABMyWOlAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzs3XmcjeX/x/HXmTGDsZshIrIbW4ydGbsh8rUkDBJKkWSU\nQnaJiBBKtrJFEUKyryOhsU1Zs2U3GPvYZs7vj3v8LGFmOPe5zxnv5+NxHmPOue/7+jTfb3nPfV/X\n5wIREREREREREREREREREREREREREREREREREREREREREREREREREREREREREXFzPYAtwCXgNDAP\nyB/POVWA2Ie84jtPRERETOZh0nUrAaOBskBNIBmwDPBJwLn5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ZMXPmTGbOnHnfexcuXEj0dcxeLD8a+B/GJMgj8Ry7FtgGhN7z\nXkPgRyAlEPPA8QFAeHh4OAEBAY6p1iSNfmzElhNb2NNxD6m8U1ldjiXOXTtHnR/qsCtyF780+4Vq\nuapZXZKIyDNr69atlCxZEqAksDUh55j1SMKGcWehAVCN+MMCwEaMFRX3CsZYnvlgWHAbqw6tYt6e\neQytMfSZDQtgtJJe2WolFV6owMszXubnXT9bXZKIiCSCWYFhLNAi7nUVyBL3SnHPMYOBKfd8Pw7I\nCQwH/IG2ca9hJtVoutuxtwldEkqFFyrQrEgzq8uxXGrv1CwMWUjDgg1pMqcJE8InWF2SiIgkkFlz\nGNoDdmDNA++3BqbG/TkL8MI9nx0G6mBMkOwIHAc6YTR9cksTwicQcSaCLe22qFVyHG9Pb2Y0moFv\nSl/eXvQ2kdci6RHYQz8
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure at 0x7fa4e0e32350>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Define model function to be used to fit to the data above:\n",
|
||
|
"def tophat_time(x, *p):\n",
|
||
|
" mean, width = p\n",
|
||
|
" if x>(mean+width): y=0\n",
|
||
|
" if x<(mean-width): y=0\n",
|
||
|
" if x==(mean+width) | x==(mean-width): y=5\n",
|
||
|
" return y\n",
|
||
|
"\n",
|
||
|
"def tophat_freq(f, *pars):\n",
|
||
|
" A,T,t0 = pars\n",
|
||
|
" #return A*T*sinc(pi*f*T)*exp(-i*2*pi*f*t0)\n",
|
||
|
" return A*T*sinc(pi*f*T)*cos(2*pi*f*t0)\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"# p0 is the initial guess for the fitting coefficients\n",
|
||
|
"p0 = [3, 3, 3]\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"#x=np.linspace(1,50,200)\n",
|
||
|
"\n",
|
||
|
"# freq bins we agreed on\n",
|
||
|
"x=array([ 0.00964867, 0.02886003, 0.0556922 , 0.08632291, 0.13380051,\n",
|
||
|
" 0.20739079, 0.32145572, 0.49825637])\n",
|
||
|
"\n",
|
||
|
"# from 3471A\n",
|
||
|
"lag = array([ 1.25569486, 2.37000041, 1.7802513 , 1.66775218, 0.49069246,\n",
|
||
|
" 0.21781609, -0.44057362, 0.01545348])\n",
|
||
|
"coeff, var_matrix = curve_fit(tophat_freq, x, lag, p0=p0)\n",
|
||
|
"\n",
|
||
|
"# Get the fitted curve\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"plot(tophat_freq(x, *coeff))\n",
|
||
|
"plot(lag)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 63,
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"[<matplotlib.lines.Line2D at 0x7fa4e0df9250>]"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 63,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgIAAAFkCAYAAABSAFMWAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzt3Xt0XXWd9/F376UFjUCnbaCLq0ArCCQFoVNoS9sdwJHx\n8UEhipci6oC3go7XGZ1ZPgrPGuXiiFyHizJkRGcUQbEttJTSG5CAomCRe6GlINALvdPk+eOXPEkP\nSZN9ek5++5z9fq11VpOdvc/5dq/knM/vsn8bJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmS\nJElSDpwM3AG8CLQCf9+HY6YAzcBm4CngM2WrTpIkpTIw5f4jgIeBz7Z/39bL/gcBvwUWAscA3wN+\nCHwg5etKkqSMaQXO6GWf/wv8qWDbV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SJMWRNghcBFwP3ACsAC4EVgLn\n97D/qcDJwOnAfOB5Qi/C0mKKLbWZM6G1FebPj12JJElxpAkCQ4E6oLAzfS4wqYdjziB88H8NeIEQ\nHv4NGJ6uzPI48EA47DCHByRJ+TU4xb77AoOANQXbXwbG9HDMwYQ5BJuB9wOjgB8D+xCGCqJLErjz\nTmhrgwEDYlcjSVL/ShMEijEQaAU+Amxo33YR8AvCcMLW7g6aPXs2NTU1O21rbGyksbGx5AUmCfzo\nR/DUU3DooSV/ekmSSq6pqYmmpqadtq0tcsJbmiDwV2AHMLpg+2hgdQ/HrAZW0RkCIEwUHADsDzzV\n3UGXX345dXV1KUor3tSpMHhwGB4wCEiSKkF3jeOWlhbq6+tTP1eaOQLbgGYgKdg+E1jSwzH3A7XA\nyC7bDiP0EryQ4rXLZq+
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure at 0x7fa4e0fdc4d0>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"time_fit = ifft(fit)\n",
|
||
|
"plot(time_fit)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 30,
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"[<matplotlib.lines.Line2D at 0x7fa4e18f6a50>]"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 30,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiIAAAFrCAYAAADsC+ITAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzsnXmYXGWZvu9Od/YQmhBIwhZCCBgCAZJAICAwOKwqqOCS\n0RkRBRXUA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LV\nlAghhBBpybwQKeeIVDqz6pYtpbclhBBCiGIyL0TC33HBUakjIiEihBBCVEbmhUgoMuICotIaEQkR\nIYQQojIyJUTa20s7IlBcJ1LpqBkXLBIiQgghRDoyJUTkiAghhBA9i60hRM4C5gEbgenA4R20PxKY\nkW//KvDZ2OtnAA8Db+d/7gUOShNIuRoRKHZEVCMihBBCVJdqC5GPApcB3wEOwATEncCuJdqPAu4A\nHsy3/x7wM+BDQZsjgT8ARwGHAguAe4CdOgqm2o6IUjNCCCFEZVRbiJwH/Ab4X+Bl4FxgIfD5Eu0/\nB8zPr/cycE1+3fODNp8ArgSey7c5AzuOozsKplJHpNIaETkiQgghRGVUU4j0ASZgbkXIPcCUEusc\nWqL9JKCxxDoDgd5YmqYsqhERQgghehbVFCJDMfGwNLZ8GTC8xDrDEtovBZry20viB8Ai4L6OAurI\nEVFqRgghhNi6NNU6gC7yZawO5Sigw+6/I0dEqRkhhBBi61JNIbIcaMNcjpBhwOIS6yyh2C0ZBrTm\ntxdyPnAR8B7ghXKBnHPOOTQ3NzN/Ptx+uy17/PGpnH761G51RCREhBBC1CPTpk1j2rRpBctWrVq1\nVfZdTSGyGRuGeyxwS7D
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure at 0x7fa4e1874e90>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"xscale('log')\n",
|
||
|
"plot(np.logspace(0.01,10,200),sinc(pi*x))\n",
|
||
|
"#len(sinc(pi*x))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 49,
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"[<matplotlib.lines.Line2D at 0x7fa4e16203d0>]"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 49,
|
||
|
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w8/58MWH0Gd\njxtuAF5++eDrSAghhISB0IuPdDkf0ajM45W4SgghhBBDaMSHCo6gzoctOII4H1qG4oMQQghJTGjE\nR6ojnKbqfBw44L0cQgghhDgJvfjwe7dLqjkfdD4IIYSQYIRefPg5H7bbkYrzoX8JIYQQ4k3oxUe6\nnA+GXQghhJBgZEN8fA/AKgA1AOYCOCVJ+VEA5sXKrwBwk+v3GwF8CGBH7PMWgOHJKpHpnA+GXQgh\nhJBgZFp8XAlgEoD7AAyBiIapALr6lO8B4E0AH8TKPwDg/wBcYpUZBeB5AKcDGAFgLYDpADonqkiq\nzkeqvV3ofBBCCCHByLT4uB3AnwA8BWAJgNsArAPwXZ/y3wGwOjbfEgBPxua9wypzDYDHAXweK3Mj\nZDvOSFQR9nYhhBBCmgaZFB8FAMohroTNdAAjfeYZ4VN+GIBcn3laAsiHhGB8scWHLSbSNcIpxQch\nhBASjEyKj/YQwbDFNX0rgI4+85R5lN8CIC+2PC8eBLAewNuJKpPqCKep9nZhzgchhBASjLzGrsAh\nchckr+R0AAmb/Uy/24XOByGEEBKMTIqPbQDqIW6GTRmATT7zbEa8K1IGoC62PJs7APwYwJkAvkxU\nkQkTJqCmpgQA8MYbwI4dQEXFWIwdOzZt73ah+CCEEHK4UlFRgYqKCse0ysrKjK0vk+KjFtJldjSA\nf1rTzwbwis88swFc5Jo2GsDHECGj3AXg7thv85NVZPLkyVixohxXXAFcfjnw5JPA2LHyW7qcD4Zd\nCCGEHK6MHSsP5Dbz58/H0KFDM7K+TPd2eRjADQDGA+gP6XbbBdJbBQB+AeBpq/zjALoD+E2s/PWx\nz6+tMj8EcG9s+lqIU9I
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure at 0x7fa4e15acf50>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plot(np.fft.fft(ifft(sinc(pi*x))))\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 54,
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"ename": "NameError",
|
||
|
"evalue": "name 'A' is not defined",
|
||
|
"output_type": "error",
|
||
|
"traceback": [
|
||
|
"\u001b[0;31m----------------------------------------------\u001b[0m",
|
||
|
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
||
|
"\u001b[0;32m<ipython-input-54-e6c186659f7e>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mA\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mT\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0msinc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpi\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mT\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mcos\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mpi\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mt0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
|
||
|
"\u001b[0;31mNameError\u001b[0m: name 'A' is not defined"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"A*T*sinc(pi*f*T)*cos(2*pi*f*t0)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {
|
||
|
"collapsed": false
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"ename": "NameError",
|
||
|
"evalue": "name 'np' is not defined",
|
||
|
"output_type": "error",
|
||
|
"traceback": [
|
||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||
|
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
||
|
"\u001b[0;32m<ipython-input-1-d7dd796a61c3>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mA\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mT\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0msinc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpi\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mT\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mcos\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mpi\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mt0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 15\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 16\u001b[0;31m \u001b[0mx\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlogspace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfqd\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mfqd\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m200\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 17\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 18\u001b[0m \u001b[0;31m# p0 is the initial guess for the fitting coefficients\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
||
|
"\u001b[0;31mNameError\u001b[0m: name 'np' is not defined"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"from scipy.optimize import curve_fit\n",
|
||
|
"\n",
|
||
|
"# Define model function to be used to fit to the data above:\n",
|
||
|
"def tophat_time(x, *p):\n",
|
||
|
" mean, width = p\n",
|
||
|
" if x>(mean+width): y=0\n",
|
||
|
" if x<(mean-width): y=0\n",
|
||
|
" if x==(mean+width) | x==(mean-width): y=5\n",
|
||
|
" return y\n",
|
||
|
"\n",
|
||
|
"def tophat_freq(f, *pars):\n",
|
||
|
" A,T,t0 = pars\n",
|
||
|
" #return A*T*sinc(pi*f*T)*exp(-i*2*pi*f*t0)\n",
|
||
|
" return A*T*sinc(pi*f*T)*cos(2*pi*f*t0)\n",
|
||
|
"\n",
|
||
|
"x=np.logspace(fqd[0],fqd[-1],200)\n",
|
||
|
"\n",
|
||
|
"# p0 is the initial guess for the fitting coefficients\n",
|
||
|
"p0 = [3, 3, 3]\n",
|
||
|
"coeff, var_matrix = curve_fit(tophat_freq, fqd, lag, p0)\n",
|
||
|
"fit = tophat_freq(fqd, *coeff)\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"mpl.rcParams['xtick.labelsize']=12\n",
|
||
|
"mpl.rcParams['ytick.labelsize']=12\n",
|
||
|
"xscale('log'); xlim(.009,.6)\n",
|
||
|
"xlabel(\"Fourier Frequency (days$^{-1}$)\",fontsize=20)\n",
|
||
|
"ylabel(\"Time Lag (days)\",fontsize=20)\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"errorbar(fqd, lag, yerr=lage, fmt='o', ms=5,color=\"black\")\n",
|
||
|
"plot(fqd,fit)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {
|
||
|
"collapsed": true
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 2",
|
||
|
"language": "python",
|
||
|
"name": "python2"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 2
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython2",
|
||
|
"version": "2.7.6"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|