Skip to content

Commit

Permalink
Updating fits xray images notebook.
Browse files Browse the repository at this point in the history
  • Loading branch information
chummels committed May 20, 2021
1 parent 0ed9121 commit efb3411
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions doc/source/cookbook/fits_xray_images.ipynb
Expand Up @@ -70,15 +70,15 @@
"source": [
"def _counts(field, data):\n",
" exposure_time = data.get_field_parameter(\"exposure_time\")\n",
" return data[\"flux\"]*data[\"pixel\"]*exposure_time\n",
" return data[(\"fits\", \"flux\")]*data[(\"fits\", \"pixel\")]*exposure_time\n",
"ds.add_field((\"gas\",\"counts\"), function=_counts, sampling_type=\"cell\", units=\"counts\", take_log=False)\n",
"\n",
"def _pp(field, data):\n",
" return np.sqrt(data[\"counts\"])*data[\"projected_temperature\"]\n",
" return np.sqrt(data[(\"gas\", \"counts\")])*data[(\"fits\", \"projected_temperature\")]\n",
"ds.add_field((\"gas\",\"pseudo_pressure\"), function=_pp, sampling_type=\"cell\", units=\"sqrt(counts)*keV\", take_log=False)\n",
"\n",
"def _pe(field, data):\n",
" return data[\"projected_temperature\"]*data[\"counts\"]**(-1./3.)\n",
" return data[(\fits\", \"projected_temperature\")]*data[(\"gas\", \"counts\")]**(-1./3.)\n",
"ds.add_field((\"gas\",\"pseudo_entropy\"), function=_pe, sampling_type=\"cell\", units=\"keV*(counts)**(-1/3)\", take_log=False)"
]
},
Expand Down Expand Up @@ -116,11 +116,11 @@
"outputs": [],
"source": [
"slc = yt.SlicePlot(ds, \"z\", \n",
" [\"flux\",\"projected_temperature\",\"pseudo_pressure\",\"pseudo_entropy\"], \n",
" [(\"fits\", \"flux\"), (\"fits\", \"projected_temperature\"), (\"gas\", \"pseudo_pressure\"), (\"gas\", \"pseudo_entropy\")], \n",
" origin=\"native\", field_parameters={\"exposure_time\":exposure_time})\n",
"slc.set_log(\"flux\",True)\n",
"slc.set_log(\"pseudo_pressure\",False)\n",
"slc.set_log(\"pseudo_entropy\",False)\n",
"slc.set_log((\"fits\", \"flux\"),True)\n",
"slc.set_log((\"gas\", \"pseudo_pressure\"),False)\n",
"slc.set_log((\"gas\", \"pseudo_entropy\"),False)\n",
"slc.set_width(250.)\n",
"slc.show()"
]
Expand Down Expand Up @@ -160,7 +160,7 @@
},
"outputs": [],
"source": [
"v, c = ds.find_max(\"flux\") # Find the maximum flux and its center\n",
"v, c = ds.find_max((\"fits\", \"flux\")) # Find the maximum flux and its center\n",
"my_sphere = ds.sphere(c, (100.,\"code_length\")) # Radius of 150 pixels\n",
"my_sphere.set_field_parameter(\"exposure_time\", exposure_time)"
]
Expand Down Expand Up @@ -268,13 +268,13 @@
"outputs": [],
"source": [
"prj = yt.ProjectionPlot(ds, \"z\", \n",
" [\"flux\",\"projected_temperature\",\"pseudo_pressure\",\"pseudo_entropy\"], \n",
" [(\"fits\", \"flux\"), (\"fits\", \"projected_temperature\"), (\"gas\", \"pseudo_pressure\"), (\"gas\", \"pseudo_entropy\"]), \n",
" origin=\"native\", field_parameters={\"exposure_time\":exposure_time},\n",
" data_source=circle_reg,\n",
" method=\"sum\")\n",
"prj.set_log(\"flux\",True)\n",
"prj.set_log(\"pseudo_pressure\",False)\n",
"prj.set_log(\"pseudo_entropy\",False)\n",
"prj.set_log((\"fits\", \"flux\"),True)\n",
"prj.set_log((\"gas\", \"pseudo_pressure\"),False)\n",
"prj.set_log((\"gas\", \"pseudo_entropy\"),False)\n",
"prj.set_width(250.)\n",
"prj.show()"
]
Expand Down Expand Up @@ -357,8 +357,8 @@
"outputs": [],
"source": [
"dd = ds2.all_data()\n",
"print (dd[\"event_x\"])\n",
"print (dd[\"event_y\"])"
"print (dd[(\"io\", \"event_x\")])\n",
"print (dd[(\"io\", \"event_y\")])"
]
},
{
Expand All @@ -376,7 +376,7 @@
},
"outputs": [],
"source": [
"slc = yt.SlicePlot(ds2, \"z\", [\"counts_0.1-2.0\",\"counts_2.0-5.0\"], origin=\"native\")\n",
"slc = yt.SlicePlot(ds2, \"z\", [(\"gas\", \"counts_0.1-2.0\"), (\"gas\", \"counts_2.0-5.0\")], origin=\"native\")\n",
"slc.pan((100.,100.))\n",
"slc.set_width(500.)\n",
"slc.show()"
Expand All @@ -397,12 +397,12 @@
},
"outputs": [],
"source": [
"slc = yt.SlicePlot(ds2, \"z\", [\"counts_0.1-2.0\",\"counts_2.0-5.0\"], origin=\"native\",\n",
"slc = yt.SlicePlot(ds2, \"z\", [(\"gas\", \"counts_0.1-2.0\"), (\"gas\", \"counts_2.0-5.0\")], origin=\"native\",\n",
" field_parameters={\"sigma\":2.}) # This value is in pixel scale\n",
"slc.pan((100.,100.))\n",
"slc.set_width(500.)\n",
"slc.set_zlim(\"counts_0.1-2.0\", 0.01, 100.)\n",
"slc.set_zlim(\"counts_2.0-5.0\", 0.01, 50.)\n",
"slc.set_zlim((\"gas\", \"counts_0.1-2.0\"), 0.01, 100.)\n",
"slc.set_zlim((\"gas\", \"counts_2.0-5.0\"), 0.01, 50.)\n",
"slc.show()"
]
}
Expand Down

0 comments on commit efb3411

Please sign in to comment.