“Marvin”的版本间差异

来自Shiyin's note
跳到导航 跳到搜索
无编辑摘要
→‎Maps
第18行: 第18行:
==Maps==
==Maps==
*读取dap中的map
*读取dap中的map
:map的data model 可以参 https://sdss-marvin.readthedocs.io/en/latest/datamodel/mpl10.html?highlight=property%20name#dap-datamodel
*map的datamodel,可以参 [https://sdss-marvin.readthedocs.io/en/latest/datamodel/mpl10.html?highlight=property%20name#dap-datamodel]
dapmap = Maps(DAPfile) # Read dap maps

dapmap.datamodel
ha = dapmap['gflux ha']
ha = dapmap['gflux ha']
gflux=dapmap.getMap('spx_mflux',channel=None)
gflux=dapmap.getMap('spx_mflux',channel=None)


* 速度弥散度的改正 inst_sigma_correction() #marvin.tools.quantities.map.Map.inst_sigma_correction
* 速度弥散度的改正 inst_sigma_correction() #marvin.tools.quantities.map.Map.inst_sigma_correction

2022年6月5日 (日) 11:37的版本

安装

  • pip install sdss-marvin
  • pip install -U sdss-marvin

配置

  • 注意设置一些环境变量,关键是要找到dapall文件
setenv SAS_BASE_DIR $HOME/MaNGA
setenv MANGA_SPECTRO_REDUX $SAS_BASE_DIR/mangawork/manga/spectro/redux 
setenv MANGA_SPECTRO_ANALYSIS $SAS_BASE_DIR/mangawork/manga/spectro/analysis
  • mode
import marvin
marvin.config.mode = 'local'   # or 'remote',‘auto’
marvin.config.access = 'collab' # 'DR15'
marvin.config.setRelease("MPL-10")
  • collab模式下要设置.netrc文件

Maps

  • 读取dap中的map
  • map的datamodel,可以参考 [1]
dapmap = Maps(DAPfile) # Read dap maps
dapmap.datamodel
ha = dapmap['gflux ha']
gflux=dapmap.getMap('spx_mflux',channel=None)
  • 速度弥散度的改正 inst_sigma_correction() #marvin.tools.quantities.map.Map.inst_sigma_correction
Ha_sig=dapmap.getMap('emline_gsigma',channel='ha')
#Ha_sigcorr=dapmap.getMap('emline_gsigmacorr',channel='ha')
Ha_vdis=Ha.inst_sigma_correction()
st_sig=dapmap.getMap('stellar_sigma')
#st_sigcorr=dapmap.getMap('stellar_sigmacorr',channel='fit')
st_vdis=st_sig.inst_sigma_correction()

Mask

pixmask

  • DAP中的map类都有pixmap的类属性,可以help查看
  • 比如获得ha的map之后,可以用ha.pixmask.schema查看
pixmask的第0位是'NOCOV',就是是否天区覆盖,gflux 并没有设置这个bitmask,但是画图同样可以显示NOCOV天区,原因是因为用了ivar==0判据
np.where(gflux.ivar == 0)[0].shape
  • ha.mask其实就是ha.pixmask.mask

manga_target1.mask

  • 选源的时候的mask
from marvin.utils.general.maskbit import Maskbit
mngtarg1 = Maskbit('MANGA_TARGET1')
mngtarg1.schema
  • map也可以查看这个mask
ha.manga_target1.mask
ha.manga_target1.bits
ha.manga_target1.labels 

Translating Amongst Mask Values, Bits, and labels

ha.pixmask.values_to_bits(1073741843)  # [0, 1, 4, 30]
ha.pixmask.values_to_labels(1073741843)  #['NOCOV', 'LOWCOV', 'NOVALUE', 'DONOTUSE']
  • Translate one label
ha.pixmask.labels_to_value('NOCOV')  # 1
ha.pixmask.labels_to_bits('NOCOV')   # [0]
  • Translate multiple labels
ha.pixmask.labels_to_value(['NOCOV', 'UNRELIABLE'])  # 33
ha.pixmask.labels_to_bits(['NOCOV', 'UNRELIABLE'])  # [0, 5]

Making a Custom Mask

  • Mask of regions with no IFU coverage
nocov = ha.pixmask.get_mask('NOCOV')
  • Mask of regions with low Halpha flux and marked as DONOTUSE
low_ha = (ha.value < 1e-17) * ha.pixmask.labels_to_value('DONOTUSE')
  • Combine masks using bitwise OR (`|`)
my_mask = nocov | low_ha
fig, ax = ha.plot(mask=my_mask)