{"action":"created","issue":{"url":"https://api.github.com/repos/sunpy/sunpy/issues/1697","repository_url":"https://api.github.com/repos/sunpy/sunpy","labels_url":"https://api.github.com/repos/sunpy/sunpy/issues/1697/labels{/name}","comments_url":"https://api.github.com/repos/sunpy/sunpy/issues/1697/comments","events_url":"https://api.github.com/repos/sunpy/sunpy/issues/1697/events","html_url":"https://github.com/sunpy/sunpy/issues/1697","id":138150190,"number":1697,"title":"Independent thresholding for each layer in composite maps","user":{"login":"ajamesucl","id":15091383,"avatar_url":"https://avatars.githubusercontent.com/u/15091383?v=3","gravatar_id":"","url":"https://api.github.com/users/ajamesucl","html_url":"https://github.com/ajamesucl","followers_url":"https://api.github.com/users/ajamesucl/followers","following_url":"https://api.github.com/users/ajamesucl/following{/other_user}","gists_url":"https://api.github.com/users/ajamesucl/gists{/gist_id}","starred_url":"https://api.github.com/users/ajamesucl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajamesucl/subscriptions","organizations_url":"https://api.github.com/users/ajamesucl/orgs","repos_url":"https://api.github.com/users/ajamesucl/repos","events_url":"https://api.github.com/users/ajamesucl/events{/privacy}","received_events_url":"https://api.github.com/users/ajamesucl/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sunpy/sunpy/labels/Feature%20Request","name":"Feature Request","color":"009800"},{"url":"https://api.github.com/repos/sunpy/sunpy/labels/Map","name":"Map","color":"c7def8"},{"url":"https://api.github.com/repos/sunpy/sunpy/labels/package-novice","name":"package-novice","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2016-03-03T11:20:52Z","updated_at":"2016-04-28T06:13:45Z","closed_at":null,"body":"When using the composite map feature, I'd like to be able to set different vmin and vmax constraints for each layer. At the moment, I can set an overall vmin and vmax for the plot, but the scales of the plots used in each layer are different, so one-size-fits-all thresholds aren't appropriate.\r\n\r\nSomething similar to the alpha value that can be set for each layer would be great."},"comment":{"url":"https://api.github.com/repos/sunpy/sunpy/issues/comments/215319208","html_url":"https://github.com/sunpy/sunpy/issues/1697#issuecomment-215319208","issue_url":"https://api.github.com/repos/sunpy/sunpy/issues/1697","id":215319208,"user":{"login":"larrymanley","id":1042961,"avatar_url":"https://avatars.githubusercontent.com/u/1042961?v=3","gravatar_id":"","url":"https://api.github.com/users/larrymanley","html_url":"https://github.com/larrymanley","followers_url":"https://api.github.com/users/larrymanley/followers","following_url":"https://api.github.com/users/larrymanley/following{/other_user}","gists_url":"https://api.github.com/users/larrymanley/gists{/gist_id}","starred_url":"https://api.github.com/users/larrymanley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larrymanley/subscriptions","organizations_url":"https://api.github.com/users/larrymanley/orgs","repos_url":"https://api.github.com/users/larrymanley/repos","events_url":"https://api.github.com/users/larrymanley/events{/privacy}","received_events_url":"https://api.github.com/users/larrymanley/received_events","type":"User","site_admin":false},"created_at":"2016-04-28T06:13:45Z","updated_at":"2016-04-28T06:13:45Z","body":"@ajamesucl Here's an example script.  I'll experiment with vmin/vmax plot_settings tonight.\r\n![comp_map_demo1](https://cloud.githubusercontent.com/assets/1042961/14876841/605146d4-0cd5-11e6-9e1f-1f47701a24bb.png)\r\n```\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\nimport astropy.units as u\r\nimport sunpy.map\r\nfrom sunpy.instr.aia import aiaprep\r\n\r\nhmimap = sunpy.map.Map('hmi.fits')\r\naiamap = sunpy.map.Map('aia.fits')\r\n\r\nhmi_scale_factor = hmimap.scale.x / (0.6 * u.arcsec)\r\n\r\nhmimap = hmimap.rotate(recenter=True, scale=hmi_scale_factor.value, missing=0.0)\r\n# extract center 4096x4096 array\r\ncenter = np.floor(hmimap.meta['crpix1'])\r\nleftx = center - 4096/2\r\nrightx = center + 4096/2\r\nhmimap = hmimap.submap([leftx, rightx]*u.pix, [leftx, rightx]*u.pix)\r\nhmimap.meta['r_sun'] = hmimap.meta['rsun_obs'] / hmimap.meta['cdelt1']\r\n\r\nhmimap.data = np.clip(hmimap.data, -2000.0, 2000.0)\r\n\r\n# remove HMI magnetogram off-limb noise\r\n# thanks Drew Leonard!\r\nlowx, highx = (hmimap.xrange[0].value / hmimap.scale.x.value,\r\n               hmimap.xrange[1].value / hmimap.scale.x.value)\r\nlowy, highy = (hmimap.yrange[0].value / hmimap.scale.y.value,\r\n               hmimap.yrange[1].value / hmimap.scale.y.value)\r\nx_grid, y_grid = np.mgrid[lowx:highx-1, lowy:highy-1]\r\nr_grid = np.sqrt((x_grid ** 2.0) + (y_grid ** 2.0))\r\nouter_rad = (hmimap.rsun_obs.value * 1.0) / hmimap.scale.x.value\r\nhmimap.data[r_grid > outer_rad] = hmimap.min()\r\n\r\nhmimap.peek(draw_limb=True)\r\n\r\naiamap = aiaprep(aiamap)\r\n# aiamap.data = np.clip(aiamap.data, 0.0, 1500.0)\r\n\r\naiamap.data = np.sqrt(np.clip((aiamap.data*(4.99803 / aiamap.exposure_time.value)), 10, 6000))\r\n# LMSAL/The Sun Today intensity scaling\r\naiamap.plot_settings['norm'] = None\r\n\r\ncmap1 = hmimap.plot_settings['cmap'] = plt.get_cmap('Greys_r')\r\ncmap2 = aiamap.plot_settings['cmap'] = plt.get_cmap('sdoaia171')\r\n\r\ncomp_map = sunpy.map.Map(hmimap, composite=True, alpha=1.0)\r\ncomp_map.add_map(aiamap, alpha=0.25)\r\n\r\nfig = plt.figure()\r\nax = fig.add_subplot(111)\r\ncomp_map.plot()\r\nplt.colorbar()\r\nplt.show()\r\n\r\n```"}}