[{"data":1,"prerenderedAt":51},["ShallowReactive",2],{"analysis-playbook-maxi-allskymap-from-events":3},{"@context":4,"@type":5,"name":6,"description":7,"proficiencyLevel":8,"dependencies":9,"programmingLanguage":15,"keywords":16,"citation":25,"about":46,"articleBody":50},"https:\u002F\u002Fschema.org","TechArticle","MAXI All-Sky Map Generation from Event Data","Generate MAXI GSC\u002FSSC all-sky X-ray maps from event-by-event photon data archived on DARTS. Reads EVENTS HDUs from processed FITS files organized by MJD, filters by time and energy (PI channel), bins RA\u002FDec into HEALPix pixels, and renders Mollweide all-sky maps in Galactic coordinates using healpy.","intermediate",[10,11,12,13,14],"astropy","healpy","matplotlib","numpy","requests","Python",[17,18,19,20,21,22,23,24],"MAXI","SSC","GSC","all-sky map","X-ray","event data","HEALPix","Mollweide",[26,30,34,37,40,44],{"@type":27,"url":28,"name":29},"WebPage","https:\u002F\u002Fdarts.isas.jaxa.jp\u002Fdatasets\u002Fdarts:maxi-stddata\u002F","MAXI data for standard analysis at DARTS",{"@type":31,"url":32,"name":33},"ScholarlyArticle","https:\u002F\u002Fdoi.org\u002F10.1093\u002Fpasj\u002F61.5.999","The MAXI Mission on the ISS: Science and Instruments for Monitoring All-Sky X-Ray Images",{"@type":31,"url":35,"name":36},"https:\u002F\u002Fdoi.org\u002F10.1093\u002Fpasj\u002F63.sp3.S635","In-Orbit Performance of MAXI Gas Slit Camera (GSC) on ISS",{"@type":31,"url":38,"name":39},"https:\u002F\u002Fdoi.org\u002F10.1093\u002Fpasj\u002F62.6.1371","In-Orbit Performance of the MAXI\u002FSSC onboard the ISS",{"@type":41,"url":42,"name":43},"SoftwareApplication","https:\u002F\u002Fwww.astropy.org\u002F","Astropy",{"@type":41,"url":45,"name":11},"https:\u002F\u002Fhealpy.readthedocs.io\u002F",[47],{"@type":48,"name":49},"Dataset","darts:maxi-stddata","## MAXI All-Sky Map Generation from Event Data\n\nThis playbook describes how to generate all-sky X-ray maps by accumulating event-by-event photon data from MAXI.\nThe source dataset is [MAXI data for standard analysis](https:\u002F\u002Fdarts.isas.jaxa.jp\u002Fdatasets\u002Fdarts:maxi-stddata\u002F).\n\nFor visualizing the pre-generated map products released by the MAXI team, see `maxi-allskymap-products`.\n\n---\n\n### Data Structure\n\nProcessed event files are organized by MJD under:\n\n```\nhttps:\u002F\u002Fdata.darts.isas.jaxa.jp\u002Fpub\u002Fmaxi\u002Fmxdata\u002Fobs\u002FMJD{outer}\u002FMJD{mjd}\u002Fprocessed\u002F{instrument}\u002F\n```\n\nwhere `{outer}` is the MJD rounded down to the nearest 1000 (e.g., MJD 56001 → outer = MJD56000),\nand `{instrument}` is `gsc_low` or `ssc_med`.\n\nEach daily directory contains up to 768 event files (one per HEALPix tile).\nIf a tile has no events for that day, its file is absent.\n\n---\n\n### Energy Conversion\n\n| Instrument | Conversion | Default band | RGB bands |\n|---|---|---|---|\n| GSC (`gsc_low`) | 1 keV = 20 PI | 2–20 keV | R: 2–4, G: 4–8, B: 8–16 keV |\n| GSC (`gsc_med`) | 1 keV = 20 PI | 2–20 keV | R: 2–4, G: 4–8, B: 8–16 keV |\n| SSC (`ssc_med`) | 1 PI = 0.00365 keV | 0.7–7 keV | R: 0.7–1, G: 1–2, B: 2–4 keV |\n\n---\n\n### Generating a Map with Python\n\n#### Requirements\n\n```\npip install astropy healpy numpy matplotlib requests\n```\n\n#### Helper functions\n\n```python\nimport re\nimport numpy as np\nimport requests\nimport healpy as hp\nimport matplotlib.pyplot as plt\nfrom astropy.io import fits\nfrom astropy.coordinates import SkyCoord\nfrom astropy.time import Time\nimport astropy.units as u\n\nBASE_URL = \"https:\u002F\u002Fdata.darts.isas.jaxa.jp\u002Fpub\u002Fmaxi\u002Fmxdata\u002Fobs\"\n\nGSC_PI_PER_KEV = 20.0\nSSC_KEV_PER_PI = 0.00365\n\nDEFAULT_BANDS = {\n    \"gsc_low\": (2.0, 20.0),\n    \"ssc_med\": (0.7, 7.0),\n}\nRGB_BANDS = {\n    \"gsc_low\": [(2.0, 4.0), (4.0, 8.0), (8.0, 16.0)],\n    \"ssc_med\": [(0.7, 1.0), (1.0, 2.0), (2.0, 4.0)],\n}\n\ndef energy_to_pi(instrument, e_kev):\n    if instrument == \"gsc_low\":\n        return e_kev * GSC_PI_PER_KEV\n    else:\n        return e_kev \u002F SSC_KEV_PER_PI\n\ndef dir_url(instrument, mjd):\n    outer = (mjd \u002F\u002F 1000) * 1000\n    return f\"{BASE_URL}\u002FMJD{outer}\u002FMJD{mjd}\u002Fprocessed\u002F{instrument}\u002F\"\n\ndef list_evt_files(url):\n    resp = requests.get(url, timeout=30)\n    if resp.status_code != 200:\n        return []\n    return [url + name for name in re.findall(r'href=\"(mx_\\w+\\.evt\\.gz)\"', resp.text)]\n\ndef read_events(file_url, pi_min, pi_max, t_start=None, t_stop=None):\n    with fits.open(file_url) as hdul:\n        ev = hdul[\"EVENTS\"].data\n    mask = (ev[\"PI\"] >= pi_min) & (ev[\"PI\"] \u003C pi_max)\n    if t_start is not None:\n        mask &= ev[\"TIME\"] >= t_start\n    if t_stop is not None:\n        mask &= ev[\"TIME\"] \u003C t_stop\n    return ev[\"RA\"][mask], ev[\"DEC\"][mask]\n\ndef events_to_hpmap(ra_deg, dec_deg, nside=256):\n    coords = SkyCoord(ra=ra_deg * u.deg, dec=dec_deg * u.deg, frame=\"icrs\").galactic\n    ipix = hp.ang2pix(nside, np.pi \u002F 2 - coords.b.rad, coords.l.rad)\n    hpmap = np.zeros(hp.nside2npix(nside))\n    np.add.at(hpmap, ipix, 1)\n    return hpmap\n```\n\n#### Single-band map\n\n```python\ndef make_allsky_map(instrument, mjd_start, mjd_stop,\n                    e_min=None, e_max=None, nside=256,\n                    t_start=None, t_stop=None):\n    if e_min is None:\n        e_min, e_max = DEFAULT_BANDS[instrument]\n    pi_min = energy_to_pi(instrument, e_min)\n    pi_max = energy_to_pi(instrument, e_max)\n\n    ra_all, dec_all = [], []\n    for mjd in range(mjd_start, mjd_stop + 1):\n        for furl in list_evt_files(dir_url(instrument, mjd)):\n            try:\n                ra, dec = read_events(furl, pi_min, pi_max, t_start, t_stop)\n                ra_all.append(ra)\n                dec_all.append(dec)\n            except Exception:\n                pass\n\n    if not ra_all:\n        return np.zeros(hp.nside2npix(nside))\n    return events_to_hpmap(np.concatenate(ra_all), np.concatenate(dec_all), nside)\n\n\n# Example: GSC 2–20 keV, January 2012\nmjd_start = int(Time(\"2012-01-01\").mjd)\nmjd_stop  = int(Time(\"2012-01-31\").mjd)\n\nhpmap = make_allsky_map(\"gsc_low\", mjd_start, mjd_stop)\n\ndisp = np.where(hpmap > 0, hpmap, np.nan)\nhp.mollview(disp, coord=[\"G\"], cmap=\"afmhot\", norm=\"log\",\n            title=\"MAXI\u002FGSC All-Sky Map (2–20 keV, 2012-01)\",\n            unit=\"counts\u002Fpixel\")\nhp.graticule()\nplt.savefig(\"maxi_gsc_allsky.png\", dpi=150, bbox_inches=\"tight\")\nplt.close()\n```\n\n#### RGB three-color map\n\n```python\ndef make_rgb_map(instrument, mjd_start, mjd_stop, nside=256):\n    channels = []\n    for e_min, e_max in RGB_BANDS[instrument]:\n        hpmap = make_allsky_map(instrument, mjd_start, mjd_stop,\n                                e_min=e_min, e_max=e_max, nside=nside)\n        channels.append(hpmap)\n    return channels\n\ndef plot_rgb(channels, title=\"MAXI All-Sky RGB Map\"):\n    def norm(arr):\n        arr = np.where(arr > 0, arr, 0.0)\n        vmax = np.percentile(arr[arr > 0], 99) if np.any(arr > 0) else 1.0\n        return np.clip(arr \u002F vmax, 0, 1)\n\n    maps_2d = []\n    for ch in channels:\n        m2d = hp.mollview(norm(ch), coord=[\"G\"], return_projected_map=True)\n        plt.close()\n        maps_2d.append(np.where(m2d.mask, 0.0, m2d.data))\n\n    rgb = np.stack(maps_2d, axis=-1)\n    fig, ax = plt.subplots(figsize=(12, 6))\n    ax.imshow(rgb, origin=\"lower\", aspect=\"auto\")\n    ax.set_title(title)\n    plt.tight_layout()\n    plt.savefig(\"maxi_allsky_rgb.png\", dpi=150, bbox_inches=\"tight\")\n    plt.close()\n\n\n# Example: SSC RGB, January 2012\nchannels = make_rgb_map(\"ssc_med\", mjd_start, mjd_stop)\nplot_rgb(channels, title=\"MAXI\u002FSSC All-Sky RGB Map (R: 0.7–1, G: 1–2, B: 2–4 keV)\")\n```\n\n---\n\n### Acknowledgement\n\nWhen using this data in publications, please include:\n\n> \"This research has made use of MAXI data provided by RIKEN, JAXA and the MAXI team.\"\n\nand cite:\n\n- Matsuoka, M. et al. (2009), PASJ, 61, 999. [doi:10.1093\u002Fpasj\u002F61.5.999](https:\u002F\u002Fdoi.org\u002F10.1093\u002Fpasj\u002F61.5.999)\n- Sugizaki, M. et al. (2011), PASJ, 63, S635. [doi:10.1093\u002Fpasj\u002F63.sp3.S635](https:\u002F\u002Fdoi.org\u002F10.1093\u002Fpasj\u002F63.sp3.S635) — for GSC\n- Tomida, H. et al. (2010), PASJ, 62, 1371. [doi:10.1093\u002Fpasj\u002F62.6.1371](https:\u002F\u002Fdoi.org\u002F10.1093\u002Fpasj\u002F62.6.1371) — for SSC\n",1780296758201]