import numpy as np
from marvin.tools import Maps
maps = Maps('8485-1901')
ha = maps.emline_gflux_ha_6564
masks = maps.get_bpt(show_plot=False, return_figure=False)

# Create a bitmask for non-star-forming spaxels by taking the
# complement (`~`) of the BPT global star-forming mask (where True == star-forming)
# and set bit 30 (DONOTUSE) for those spaxels.
mask_non_sf = ~masks['sf']['global'] * ha.pixmask.labels_to_value('DONOTUSE')

# Do a bitwise OR between DAP mask and non-star-forming mask.
mask = ha.mask | mask_non_sf

ha.plot(mask=mask)