Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Updates -- Another update attempt #116

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0c1fba2
Remove unallowed json escape characters
Mulan-94 Feb 18, 2025
c5527e8
Fix not-working position widget
Mulan-94 Feb 18, 2025
7793ab8
Fix missing textwrap.dedent and ipywidgets.interact imports
Mulan-94 Feb 19, 2025
424f7f6
Add citation for the new radio spectropolarimetric properties of Cygn…
Mulan-94 Feb 19, 2025
8b8b358
Fixup badly exscaped latex characters
Mulan-94 Feb 19, 2025
37aa58b
Fix non-running interactive code
Mulan-94 Feb 19, 2025
a523b24
Touched and checked
Mulan-94 Feb 19, 2025
595bb49
Fix non-functional interactivity of one plot
Mulan-94 Feb 19, 2025
efb5500
Move to python3 print statements
Mulan-94 Feb 19, 2025
25f68f0
Minor plot aesthetics edit
Mulan-94 Feb 19, 2025
d7cc612
Minor fix for interactive plot
Mulan-94 Feb 19, 2025
d0eaadf
move to python3 statements
Mulan-94 Feb 19, 2025
a9f4009
Clear cell outputs
Mulan-94 Feb 19, 2025
915916d
xrange -> range for python 3
Mulan-94 Feb 19, 2025
7af058e
Clear all cell outputs
Mulan-94 Feb 19, 2025
a94ba91
Minor plot fixes
Mulan-94 Feb 19, 2025
0411001
Minor fix on unrendered mpl image
Mulan-94 Feb 19, 2025
70d107b
Minor fix some non-running interactive plots
Mulan-94 Feb 19, 2025
a155dd9
Ensure integer division for python3
Mulan-94 Feb 19, 2025
6c97eff
ensure proper interger division
Mulan-94 Feb 20, 2025
c92287c
python2 -> python3
Mulan-94 Feb 20, 2025
cecd3c2
Replace obsolete aplpy methods
Mulan-94 Feb 20, 2025
15e34bd
Fix some aplpy display stuff
Mulan-94 Feb 20, 2025
05f6991
Fix some non-running code
Mulan-94 Feb 20, 2025
3c2732e
Fix aplpy stuff small small
Mulan-94 Feb 20, 2025
13d0685
Fix some non-running code
Mulan-94 Feb 20, 2025
d65c3ff
python2 -> python3
Mulan-94 Feb 20, 2025
e0dfae5
Fix small error syntax
Mulan-94 Feb 20, 2025
12c3c74
Minor fixes
Mulan-94 Feb 20, 2025
0b07364
Fix some minor mpl stuff
Mulan-94 Feb 20, 2025
3ed11d1
Fix error in these figures, Azimuth and elevation interchanged
Mulan-94 Feb 20, 2025
78ac8b5
Add support for binder
Mulan-94 Feb 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 0_Introduction/1_glossary.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@
" * $\\mathbf{P}$ : parallactic angle\n",
"* Jy : Jansky, Flux density unit, $1\\ \\mathrm{Jy} = 10^{-26} \\ \\mathrm{W\\, m^{-2}\\, Hz^{-1}}$\n",
"* $\\kappa_{\\nu}$ : Radiative absorption coefficient\n",
"* $L$: Bolometric Luminosity ($\mathrm{W}$ or $\mathrm{erg\,s^{-1}}$)\n",
"* $L$: Bolometric Luminosity ($\\mathrm{W}$ or $\\mathrm{erg,s^{-1}}$)\n",
"* $L_{\\nu}$: Spectral luminosity ($\\mathrm{W\\ s^{-1} \\ Hz^{-1}}$ or $\\mathrm{ergs\\, s^{-1} \\, Hz^{-1}}$)\n",
"* $\\boldsymbol{\\mathcal{M}}$ : see $\\boldsymbol{\\mathcal{D}}$\n",
"* $P$ : Power (W, ergs)\n",
Expand Down
18 changes: 11 additions & 7 deletions 1_Radio_Science/1_10_limits_of_single_dishes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"from IPython.display import HTML \n",
"from IPython.display import HTML\n",
"HTML('../style/course.css') #apply general CSS"
]
},
Expand All @@ -50,8 +50,9 @@
"metadata": {},
"outputs": [],
"source": [
"import ipywidgets\n",
"from IPython.display import Image"
"from ipywidgets import interact\n",
"from IPython.display import Image\n",
"from textwrap import dedent"
]
},
{
Expand Down Expand Up @@ -144,7 +145,10 @@
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
"collapsed": true,
"jupyter": {
"outputs_hidden": true
}
},
"source": [
"If we consider a generic radio telescope dish, ignoring blockage from feeds and structure and any practical issues, we can think of the dish as having a circular aperture. We will use the term 'primary beam' later in Chapter 7 to discuss this aperture in detail. Until then we can think of the dish aperture size as being the *collecting area*. The larger the aperture the more collecting area, thus the more *sensitive* (a measure of how well the telescope is able to measure a signal) the telescope. This is the same as in photography. Since we are modelling our simple telescope as a circle then the collection area $A$, or aperture size, is proportional to the square of the dish diameter $D$.\n",
Expand Down Expand Up @@ -508,7 +512,7 @@
"lastKernelId": null
},
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -522,9 +526,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 1
"nbformat_minor": 4
}
12 changes: 6 additions & 6 deletions 1_Radio_Science/1_9_a_brief_introduction_to_interferometry.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
" to render fringes from multiple invocations of double_slit() into the\n",
" same intensity scale, i.e. for comparison.\n",
" \"\"\"\n",
" \n",
" positions = [positions] if isinstance(positions, float) else positions\n",
" p0 = np.atleast_1d(positions)\n",
" a0 = np.atleast_1d(intensities)\n",
" \n",
Expand Down Expand Up @@ -271,7 +271,7 @@
" **{**defaults,\n",
" **dict(baseline=(0.1, 2 , 0.01),\n",
" wavelength=(0.05, 0.2, 0.01),\n",
" positions=FloatSlider(min=-1, max=1, step=0.01, description='position'))});"
" positions=(-1, 1, 0.01))});"
]
},
{
Expand Down Expand Up @@ -634,7 +634,7 @@
" ax.plot([0, 0], [-bl2, bl2], 'o', ms=10)\n",
" ax.plot([0, d2/2., d2/2., d2], [-bl2, -bl2, -d3/2., 0], '-k')\n",
" ax.plot([0, d2/2., d2/2., d2], [bl2, bl2, d3/2., 0], '-k')\n",
" ax.text(0, 0, f'$b={baseline:.2f}\\lambda$', ha='right', va='bottom', size='xx-large')\n",
" ax.text(0, 0, f'$b={baseline:.2f}\\\\lambda$', ha='right', va='bottom', size='xx-large')\n",
"\n",
" # draw representation of sine wave from the central position\n",
" xw = np.arange(-d1, -d1 + (d1 + d2) / 4, 0.01)\n",
Expand Down Expand Up @@ -770,7 +770,7 @@
"lastKernelId": null
},
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -784,9 +784,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 1
"nbformat_minor": 4
}
13 changes: 8 additions & 5 deletions 1_Radio_Science/1_x_further_reading_and_references.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
"collapsed": true,
"jupyter": {
"outputs_hidden": true
}
},
"source": [
"***\n",
Expand Down Expand Up @@ -38,7 +41,7 @@
"\n",
"For technical aspects of this chapter, especially emission mechanisms, see [<cite data-cite='1981PEPI...25..432L'>Radiative Processes in Astrophysics</cite> &#10548;](http://adsabs.harvard.edu/abs/1985rpa..book.....R) and [<cite data-cite='2012tra..book.....W'>Tools of Radio Astronomy</cite> &#10548;](http://adsabs.harvard.edu/abs/2012tra..book.....W).\n",
"\n",
"For an excellent account of the astronomical processes taking place in Cygnus A, see [<cite data-cite='1996A&ARv...7....1C'>Cygnus A</cite> &#10548;](https://ned.ipac.caltech.edu/level5/Carilli/Car_contents.html)."
"For an excellent account of the astronomical processes taking place in Cygnus A, see [<cite data-cite='1996A&ARv...7....1C'>Cygnus A</cite> &#10548;](https://ned.ipac.caltech.edu/level5/Carilli/Car_contents.html), and [<cite data-cite='10.3847/1538-4357/abb80e'>A Wideband Polarization Study of Cygnus A with the Jansky Very Large Array. I. The Observations and Data</cite>](https://ui.adsabs.harvard.edu/abs/2020ApJ...903...36S/abstract) for its radio spectropolarimetric properties."
]
},
{
Expand All @@ -57,7 +60,7 @@
"lastKernelId": null
},
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -71,9 +74,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 1
"nbformat_minor": 4
}
226 changes: 47 additions & 179 deletions 2_Mathematical_Groundwork/2_10_linear_algebra.ipynb

Large diffs are not rendered by default.

45 changes: 26 additions & 19 deletions 2_Mathematical_Groundwork/2_11_least_squares.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
"collapsed": true,
"jupyter": {
"outputs_hidden": true
}
},
"source": [
"Import standard modules:"
Expand Down Expand Up @@ -92,7 +95,10 @@
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
"collapsed": true,
"jupyter": {
"outputs_hidden": true
}
},
"source": [
"$\\mathbf{r}$ is the residual vector and it is a measure of the difference between the values predicted by our model and the observed values."
Expand Down Expand Up @@ -465,9 +471,9 @@
"metadata": {},
"outputs": [],
"source": [
"plt.plot(t, d, label=\"Data\")\n",
"plt.plot(t, sinusoid(solved_x, t), label=\"LM\")\n",
"plt.plot(t, sinusoid(true_x, t), label=\"Truth\")\n",
"plt.plot(t, d, label=\"Data\", lw=3, alpha=0.5)\n",
"plt.plot(t, sinusoid(true_x, t), label=\"Truth\", lw=3, alpha=1)\n",
"plt.plot(t, sinusoid(solved_x, t), label=\"LM\", lw=3, ls=\"--\")\n",
"plt.xlabel(\"t\")\n",
"plt.legend(loc='upper right')\n",
"plt.show()"
Expand All @@ -476,22 +482,23 @@
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
"collapsed": true,
"jupyter": {
"outputs_hidden": true
}
},
"source": [
"The fitted values are so close to the true values that it is almost impossible to differentiate between the red and green lines in the above plot. The true values have been omitted from the following plot to make it clearer that the numerical solution does an excellent job of arriving at the correct parameter values."
"##### The fitted values are so close to the true values that it is almost impossible to differentiate between the red and green lines in the above plot. The true values have been omitted from the following plot to make it clearer that the numerical solution does an excellent job of arriving at the correct parameter values."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"plt.plot(t, d, label=\"Data\")\n",
"plt.plot(t, sinusoid(solved_x, t), label=\"LM\")\n",
"plt.plot(t, d, label=\"Data\", lw=3)\n",
"plt.plot(t, sinusoid(solved_x, t), label=\"LM\", lw=3)\n",
"plt.xlabel(\"t\")\n",
"plt.legend(loc='upper right')\n",
"plt.show()"
Expand All @@ -517,8 +524,8 @@
"print(\"scipy.optimize.leastsq: \", leastsq_x[0])\n",
"print(\"Our LM: \", solved_x)\n",
"\n",
"plt.plot(t, d, label=\"Data\")\n",
"plt.plot(t, sinusoid(leastsq_x[0], t), label=\"optimize.leastsq\")\n",
"plt.plot(t, d, label=\"Data\", lw=3)\n",
"plt.plot(t, sinusoid(leastsq_x[0], t), label=\"optimize.leastsq\", lw=3)\n",
"plt.xlabel(\"t\")\n",
"plt.legend(loc='upper right')\n",
"plt.show()"
Expand All @@ -544,8 +551,8 @@
"print(\"scipy.optimize.leastsq: \", leastsq_x[0])\n",
"print(\"Our LM: \", solved_x)\n",
"\n",
"plt.plot(t, d, label=\"Data\")\n",
"plt.plot(t, sinusoid(leastsq_x[0], t), label=\"optimize.leastsq\")\n",
"plt.plot(t, d, label=\"Data\", lw=3)\n",
"plt.plot(t, sinusoid(leastsq_x[0], t), label=\"optimize.leastsq\", lw=3)\n",
"plt.xlabel(\"t\")\n",
"plt.legend(loc='upper right')\n",
"plt.show()"
Expand Down Expand Up @@ -573,7 +580,7 @@
"lastKernelId": null
},
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -587,9 +594,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 1
"nbformat_minor": 4
}
9 changes: 5 additions & 4 deletions 2_Mathematical_Groundwork/2_14_CLEAN_in_1D.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,8 @@
" ax[1].plot(u,Ws)\n",
" ax[1].set_xlim(-20,20)\n",
" ax[1].set_ylim(0,80)\n",
" ax[0].set_title(r'$Visibility Weights$')"
" ax[0].set_title(r'$Visibility Weights$')\n",
" plt.show()"
]
},
{
Expand Down Expand Up @@ -605,7 +606,7 @@
"lastKernelId": null
},
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -619,9 +620,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 1
"nbformat_minor": 4
}
195 changes: 34 additions & 161 deletions 2_Mathematical_Groundwork/2_2_important_functions.ipynb

Large diffs are not rendered by default.

23 changes: 14 additions & 9 deletions 2_Mathematical_Groundwork/2_3_fourier_series.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@
" # Evaluate the integrand\n",
" am_int = func(x)*np.exp(-1j*2.0*m*np.pi*x/T)\n",
" # Use trapezoidal integration to get the coefficient\n",
" am = np.trapz(am_int,x)\n",
" am = np.trapezoid(am_int,x)\n",
" return am/T"
]
},
Expand Down Expand Up @@ -402,14 +402,19 @@
"metadata": {},
"outputs": [],
"source": [
"from ipywidgets import fixed\n",
"\n",
"def inter_FS(x,m,func,T):\n",
" f_F = FS_sum(x, m, func, period=T)\n",
" plt.plot(x,f_F.real,'b')\n",
" plt.plot(x,func(x),'g')\n",
"\n",
" fig, ax = plt.subplots(figsize=(16, 4))\n",
" ax.plot(x,f_F.real,'b')\n",
" ax.plot(x,func(x),'g')\n",
" plt.show()\n",
" \n",
"\n",
"interact(lambda m,T:inter_FS(x=np.linspace(-1.0,1.0,N),m=m,func=square_wave,T=T),\n",
" m=(5,100,1),T=(0,2*np.pi,0.5)) and None\n",
"interact(inter_FS, x=fixed(np.linspace(-1.0,1.0,N)), func=fixed(square_wave),\n",
" m=(5,100,1), T=(0,2*np.pi,0.5))\n",
"# <a id='math:fig:fou_decomp_inter'></a><!--\\label{math:fig:fou_decomp_inter}-->"
]
},
Expand All @@ -436,9 +441,9 @@
"lastKernelId": null
},
"kernelspec": {
"display_name": "Python 3",
"display_name": "interferometry (local)",
"language": "python",
"name": "python3"
"name": "interferometry"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -450,9 +455,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 1
"nbformat_minor": 4
}
Loading