mirror of
https://asciireactor.com/otho/phy-4660.git
synced 2024-11-28 02:45:04 +00:00
196 lines
4.4 KiB
Plaintext
196 lines
4.4 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"import numpy as np\n",
|
|
"import sys\n",
|
|
"import getopt\n",
|
|
"sys.path.insert(1,\"/usr/local/science/clag/\")\n",
|
|
"import clag\n",
|
|
"%pylab inline\n",
|
|
"\n",
|
|
"ref_file=\"lc/1367A.lc\"\n",
|
|
"echo_file=\"lc/3465A.lc\"\n",
|
|
"\n",
|
|
"dt=0.01\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"fqL = np.logspace(np.log10(0.0049999999),np.log10(0.62032418),9)\n",
|
|
"fqL = np.array([0.0049999999, 0.018619375, 0.044733049, 0.069336227,\n",
|
|
" 0.10747115, 0.16658029, 0.25819945, 0.40020915,\n",
|
|
" 0.62032418])\n",
|
|
"nfq = len(fqL) - 1\n",
|
|
"fqd = 10**(np.log10( (fqL[:-1]*fqL[1:]) )/2.)\n",
|
|
"\n",
|
|
"\n",
|
|
"## load the first light curve\n",
|
|
"ref_time, ref_strength, ref_strength_err = np.loadtxt(ref_file,\n",
|
|
" skiprows=1).T"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"## initialize the psd class for multiple light curves ##\n",
|
|
"P1 = clag.clag('psd10r',\n",
|
|
" [ref_time], [ref_strength], [ref_strength_err],\n",
|
|
" dt, fqL)\n",
|
|
"ref_psd = np.ones(nfq)\n",
|
|
"ref_psd, ref_psd_err = clag.optimize(P1, ref_psd)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"ref_psd, ref_psd_err = clag.errors(P1, ref_psd, ref_psd_err)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"xscale('log'); ylim(-4,2)\n",
|
|
"errorbar(fqd, ref_psd, yerr=ref_psd_err, fmt='o', ms=10)\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Load second light curve\n",
|
|
"echo_time, echo_strength, echo_strength_err = np.loadtxt(echo_file,skiprows=1).T\n",
|
|
"P2 = clag.clag('psd10r', [echo_time], [echo_strength], [echo_strength_err], dt, fqL)\n",
|
|
"echo_psd = np.ones(nfq)\n",
|
|
"echo_psd, echo_psd_err = clag.optimize(P2, echo_psd)\n",
|
|
"echo_psd, echo_psd_err = clag.errors(P2, echo_psd, echo_psd_err)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"xscale('log'); ylim(-4,2)\n",
|
|
"errorbar(fqd, echo_psd, yerr=echo_psd_err, fmt='o', ms=10)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"Cx = clag.clag('cxd10r',\n",
|
|
"\t\t\t\t[[ref_time,echo_time]], \n",
|
|
" \t[[ref_strength,echo_strength]],\n",
|
|
" \t[[ref_strength_err,echo_strength_err]], \n",
|
|
" dt, fqL, ref_psd, echo_psd)\n",
|
|
"\n",
|
|
"Cx_vals = np.concatenate( (ref_psd*0.7+echo_psd*0.4-0.3,ref_psd*0+0.1) )"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"Cx_vals, Cx_err = clag.optimize(Cx, Cx_vals)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"xscale('log'); ylim(-4,2)\n",
|
|
"# errorbar(fqd, Cx_vals, yerr=Cx_err, fmt='o', ms=10)\n",
|
|
"Cx_vals"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"Cx_vals, Cx_err = clag.errors(Cx,Cx_vals,Cx_err)"
|
|
]
|
|
},
|
|
{
|
|
"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
|
|
}
|