|
1455 | 1455 | },
|
1456 | 1456 | {
|
1457 | 1457 | "cell_type": "code",
|
1458 |
| - "execution_count": 2, |
| 1458 | + "execution_count": null, |
1459 | 1459 | "metadata": {},
|
1460 | 1460 | "outputs": [],
|
1461 | 1461 | "source": [
|
1462 |
| - "# response_path = Path('/Users/penguin/Documents/Grad School/Research/COSI/COSIpy/docs/tutorials/data/SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5')\n", |
1463 |
| - "response_path = Path('/Users/penguin/Documents/Grad School/Research/COSI/COSIpy/docs/tutorials/data/SMEXv12.44Ti.HEALPix04.E_1150_1164keV.binnedimaging.imagingresponse.nonsparse_nside16.area.h5')\n", |
1464 |
| - "# response_path = Path('/Users/penguin/Documents/Grad School/Research/COSI/COSIpy/docs/tutorials/data/DC2-Continuum_N-149_17-11-2024_14-32.imagingresponse_nside8.area.h5')" |
| 1462 | + "DATA_DIR = Path('/Users/penguin/Documents/Grad School/Research/COSI/COSIpy/docs/tutorials/data/')\n", |
| 1463 | + "\n", |
| 1464 | + "# response_path = DATA_DIR / Path('SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5')\n", |
| 1465 | + "response_path = DATA_DIR / Path('SMEXv12.44Ti.HEALPix04.E_1150_1164keV.binnedimaging.imagingresponse.nonsparse_nside16.area.h5')\n", |
| 1466 | + "# response_path = DATA_DIR / Path('DC2-Continuum_N-149_17-11-2024_14-32.imagingresponse_nside8.area.h5')" |
1465 | 1467 | ]
|
1466 | 1468 | },
|
1467 | 1469 | {
|
1468 | 1470 | "cell_type": "code",
|
1469 |
| - "execution_count": 3, |
| 1471 | + "execution_count": null, |
1470 | 1472 | "metadata": {},
|
1471 | 1473 | "outputs": [
|
1472 | 1474 | {
|
|
1482 | 1484 | "with FullDetectorResponse.open(response_path, unbinned=True) as response:\n",
|
1483 | 1485 | " print(f\"Pixel 0 centered at {response.pix2skycoord(0)}\")\n",
|
1484 | 1486 | " dr = response[0]\n",
|
1485 |
| - " data = response._file['DRM']['CONTENTS'][0, ...]\n", |
1486 |
| - " # dr = DetectorResponse(edges=response.axes[1:], contents=data, unit=response.unit, interpolated_NuLambda=True)\n", |
| 1487 | + " # data = response._file['DRM']['CONTENTS'][0, ...]\n", |
| 1488 | + " # dr = DetectorResponse(edges=response.axes[1:], contents=data, unit=response.unit, interpolated_NuLambda=True) # scipy.COO requires special handling\n", |
1487 | 1489 | " dr = response.get_interp_response(SkyCoord(lon=0, lat=0, frame=SpacecraftFrame(), unit=u.deg))"
|
1488 | 1490 | ]
|
1489 | 1491 | },
|
| 1492 | + { |
| 1493 | + "cell_type": "code", |
| 1494 | + "execution_count": null, |
| 1495 | + "metadata": {}, |
| 1496 | + "outputs": [], |
| 1497 | + "source": [ |
| 1498 | + "dr = dr.drop_empty_axes()" |
| 1499 | + ] |
| 1500 | + }, |
1490 | 1501 | {
|
1491 | 1502 | "cell_type": "code",
|
1492 | 1503 | "execution_count": 7,
|
|
1533 | 1544 | },
|
1534 | 1545 | {
|
1535 | 1546 | "cell_type": "code",
|
1536 |
| - "execution_count": 5, |
| 1547 | + "execution_count": null, |
1537 | 1548 | "metadata": {},
|
1538 | 1549 | "outputs": [
|
1539 | 1550 | {
|
|
1561 | 1572 | }
|
1562 | 1573 | ],
|
1563 | 1574 | "source": [
|
1564 |
| - "dr.get_spectral_response().get_interp_response({'Ei':Ei0, 'Em':Em0})" |
| 1575 | + "dr.get_spectral_response().get_interp_response({'Ei':511*u.keV, 'Em':511*u.keV})" |
1565 | 1576 | ]
|
1566 | 1577 | },
|
1567 | 1578 | {
|
1568 | 1579 | "cell_type": "code",
|
1569 |
| - "execution_count": 15, |
| 1580 | + "execution_count": null, |
| 1581 | + "metadata": {}, |
| 1582 | + "outputs": [], |
| 1583 | + "source": [ |
| 1584 | + "dr.mapping['PsiChi'] = None\n", |
| 1585 | + "dr.mapping['Theta'] = 'Theta'\n", |
| 1586 | + "dr.mapping['Zeta'] = 'Zeta'" |
| 1587 | + ] |
| 1588 | + }, |
| 1589 | + { |
| 1590 | + "cell_type": "code", |
| 1591 | + "execution_count": null, |
1570 | 1592 | "metadata": {},
|
1571 | 1593 | "outputs": [
|
1572 | 1594 | {
|
|
1586 | 1608 | }
|
1587 | 1609 | ],
|
1588 | 1610 | "source": [
|
1589 |
| - "dr[3,3,2,385]" |
| 1611 | + "dr[58,4,20,108,100] # dr[3,3,2,385]" |
| 1612 | + ] |
| 1613 | + }, |
| 1614 | + { |
| 1615 | + "cell_type": "code", |
| 1616 | + "execution_count": null, |
| 1617 | + "metadata": {}, |
| 1618 | + "outputs": [], |
| 1619 | + "source": [ |
| 1620 | + "dr.contents.shape" |
1590 | 1621 | ]
|
1591 | 1622 | },
|
1592 | 1623 | {
|
|
1614 | 1645 | "Phi0 = 12*u.deg\n",
|
1615 | 1646 | "PsiChi0 = 386\n",
|
1616 | 1647 | "\n",
|
1617 |
| - "target = {'Ei': Ei0, 'Em': Em0, 'Phi': Phi0, 'PsiChi': PsiChi0}\n", |
| 1648 | + "# target = {'Ei': Ei0, 'Em': Em0, 'Phi': Phi0, 'PsiChi': PsiChi0}\n", |
| 1649 | + "target = {'Ei': Ei0, 'Em': Em0, 'Phi': Phi0, 'Theta': 37*u.deg, 'Zeta': 201*u.deg}\n", |
1618 | 1650 | "interpolated_response_value = dr.get_interp_response(target)\n",
|
1619 | 1651 | "\n",
|
1620 | 1652 | "interpolated_response_value"
|
|
1699 | 1731 | "target = {'Ei': Ei0, 'Em': Em0, 'Phi': Phi0, 'PsiChi': PsiChi0}\n",
|
1700 | 1732 | "\n",
|
1701 | 1733 | "fig, ax = plt.subplots()\n",
|
1702 |
| - "dr.project(label1, label2).draw(ax=ax)\n", |
1703 |
| - "ax.scatter(target[label1], target[label2], marker='*')\n", |
| 1734 | + "dr.project(label1, dr.mapping[label2]).draw(ax=ax)\n", |
| 1735 | + "# ax.scatter(target[label1], target[label2], marker='*')\n", |
1704 | 1736 | "for e1 in dr.neighbors[label1]:\n",
|
1705 | 1737 | " for e2 in dr.neighbors[label2]:\n",
|
1706 | 1738 | " ax.scatter(e1, e2, c='r')\n",
|
|
0 commit comments