{"action":"created","issue":{"url":"https://api.github.com/repos/desihub/desiutil/issues/14","labels_url":"https://api.github.com/repos/desihub/desiutil/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/desihub/desiutil/issues/14/comments","events_url":"https://api.github.com/repos/desihub/desiutil/issues/14/events","html_url":"https://github.com/desihub/desiutil/pull/14","id":118156067,"number":14,"title":"Maskbits","user":{"login":"sbailey","id":218471,"avatar_url":"https://avatars.githubusercontent.com/u/218471?v=3","gravatar_id":"","url":"https://api.github.com/users/sbailey","html_url":"https://github.com/sbailey","followers_url":"https://api.github.com/users/sbailey/followers","following_url":"https://api.github.com/users/sbailey/following{/other_user}","gists_url":"https://api.github.com/users/sbailey/gists{/gist_id}","starred_url":"https://api.github.com/users/sbailey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbailey/subscriptions","organizations_url":"https://api.github.com/users/sbailey/orgs","repos_url":"https://api.github.com/users/sbailey/repos","events_url":"https://api.github.com/users/sbailey/events{/privacy}","received_events_url":"https://api.github.com/users/sbailey/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/desihub/desiutil/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"weaverba137","id":3780690,"avatar_url":"https://avatars.githubusercontent.com/u/3780690?v=3","gravatar_id":"","url":"https://api.github.com/users/weaverba137","html_url":"https://github.com/weaverba137","followers_url":"https://api.github.com/users/weaverba137/followers","following_url":"https://api.github.com/users/weaverba137/following{/other_user}","gists_url":"https://api.github.com/users/weaverba137/gists{/gist_id}","starred_url":"https://api.github.com/users/weaverba137/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaverba137/subscriptions","organizations_url":"https://api.github.com/users/weaverba137/orgs","repos_url":"https://api.github.com/users/weaverba137/repos","events_url":"https://api.github.com/users/weaverba137/events{/privacy}","received_events_url":"https://api.github.com/users/weaverba137/received_events","type":"User","site_admin":false},"milestone":null,"comments":10,"created_at":"2015-11-21T00:37:21Z","updated_at":"2015-11-24T00:05:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/desihub/desiutil/pulls/14","html_url":"https://github.com/desihub/desiutil/pull/14","diff_url":"https://github.com/desihub/desiutil/pull/14.diff","patch_url":"https://github.com/desihub/desiutil/pull/14.patch"},"body":"This PR puts maskbit code into desiutil.  After it is vetted here, desispec and desitarget can switch to using this.  This code does not actually define the mask bits (that will remain with deispec and desitarget), but it provides convenience wrapper code for manipulating target bits, e.g.:\r\n\r\n```\r\nfrom desiutil.bitmask import BitMask\r\n\r\nimport yaml\r\n_bitdefs = yaml.load('''\r\nccdmask:\r\n    - [BAD,       0, \"Pre-determined bad pixel (any reason)\"]\r\n    - [HOT,       1, \"Hot pixel\"]\r\n    - [DEAD,      2, \"Dead pixel\"]\r\n    - [SATURATED, 3, \"Saturated pixel from object\"]\r\n    - [COSMIC,    4, \"Cosmic ray\"]\r\n''')\r\nccdmask = BitMask('ccdmask', _bitdefs)\r\n\r\n#- Accessing the mask\r\nccdmask.COSMIC | ccdmask.SATURATED  #- 2**4 + 2**3\r\nccdmask.mask('COSMIC')     #- 2**4, same as ccdmask.COSMIC\r\nccdmask.mask(4)            #- 2**4, same as ccdmask.COSMIC\r\nccdmask.COSMIC             #- 2**4, same as ccdmask.mask('COSMIC')\r\nccdmask.bitnum('COSMIC')   #- 4\r\nccdmask.bitname(4)         #- 'COSMIC'\r\nccdmask.names()            #- ['BAD', 'HOT', 'DEAD', 'SATURATED', 'COSMIC']\r\nccdmask.names(3)           #- ['BAD', 'HOT']\r\nccdmask.comment(0)         #- \"Pre-determined bad pixel (any reason)\"\r\nccdmask.comment('COSMIC')  #- \"Cosmic ray\"    \r\n```"},"comment":{"url":"https://api.github.com/repos/desihub/desiutil/issues/comments/159109516","html_url":"https://github.com/desihub/desiutil/pull/14#issuecomment-159109516","issue_url":"https://api.github.com/repos/desihub/desiutil/issues/14","id":159109516,"user":{"login":"weaverba137","id":3780690,"avatar_url":"https://avatars.githubusercontent.com/u/3780690?v=3","gravatar_id":"","url":"https://api.github.com/users/weaverba137","html_url":"https://github.com/weaverba137","followers_url":"https://api.github.com/users/weaverba137/followers","following_url":"https://api.github.com/users/weaverba137/following{/other_user}","gists_url":"https://api.github.com/users/weaverba137/gists{/gist_id}","starred_url":"https://api.github.com/users/weaverba137/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaverba137/subscriptions","organizations_url":"https://api.github.com/users/weaverba137/orgs","repos_url":"https://api.github.com/users/weaverba137/repos","events_url":"https://api.github.com/users/weaverba137/events{/privacy}","received_events_url":"https://api.github.com/users/weaverba137/received_events","type":"User","site_admin":false},"created_at":"2015-11-24T00:05:50Z","updated_at":"2015-11-24T00:05:50Z","body":"Ah, too late."}}