減光マップ覚書

3次元減光マップの利用方法の覚書。


# mwdust

```python
from mwdust.util import extCurves
#print(extCurves.avebvsf.keys())

combined19_B= mwdust.Combined19(filter='Landolt B')
combined19_V= mwdust.Combined19(filter='Landolt V')


AB_ARP = 2.206
AV_ARP = 1.675
AG_ARP = 1.323
ABP_ARP= 1.700

def EBV_combined19(l,b,d_kpc):
    return combined19_B(l,b,d_kpc)-combined19_V(l,b,d_kpc)

def A_G_BP_RP_combined19(l,b,d_kpc):
    AB_ARP = 2.206
    AV_ARP = 1.675
    AG_ARP = 1.323
    ABP_ARP= 1.700

    EBV = EBV_combined19(l,b,d_kpc)
    
    EBV_ARP = (AB_ARP-AV_ARP)
    ARP = EBV/EBV_ARP
    AG  = AG_ARP*ARP
    ABP = ABP_ARP*ARP
    
    return AG, ABP, ARP
```

# 使い方

```python
AG, ABP, ARP = A_G_BP_RP_combined19(337.78435188, -19.96100426, 6.51818111)

EBV_combined19(337.78435188, -19.96100426, 6.51818111)
```


# 参考

```python
E(BP-RP)=1.321*E(B-V)   
    
E(B-V)=E(BP-RP)*[A_B/E(BP-RP) - A_V/E(BP-RP)]=E(BP-RP)*(3.151-2.394)=0.757*E(B-V)
    
# Wang & Chen (2019)
# The Optical to Mid-infrared Extinction Law Based on the APOGEE, 
# Gaia DR2, Pan-STARRS1, SDSS, APASS, 2MASS, and WISE Surveys
```

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/610740/b793f2de-7993-1e40-8086-495aec228bd5.png)


# dustmap (Green)
conda create --name py37_gaia_dr3_try1-dustmaps --clone py37_gaia_dr3_try1-naif

必要なモジュール
```
numpy
scipy
astropy
h5py
healpy
requests
six
progressbar2 # これが必要
```

https://stackoverflow.com/questions/44535616/installing-progressbar-python-package
によると、
```shell
$ conda install progressbar2
```
が良いらしい。なお、import する際は "2" の付かない
```python
import progressbar
```
となる。

```shell
$ cd ~/my_libs_3
$ conda install progressbar2


$ git clone https://github.com/gregreen/dustmaps.git

$ python setup.py install --large-data-dir=~/my_libs_3/dustmaps_DATA_directory

$ cd dustmaps

```
それぞれのdust map をダウンロードする。今はSFDだけ必要。
```python
$ python setup.py fetch --map-name=sfd
running fetch
Fetching map: sfd
Downloading SFD data file to /home/[-----]/my_libs_3/dustmaps_DATA_directory/sfd/SFD_dust_4096_ngp.fits
Downloading data to '/home/[-----]/my_libs_3/dustmaps_DATA_directory/sfd/SFD_dust_4096_ngp.fits' ...
Downloading https://dataverse.harvard.edu/api/access/datafile/2902687 ...
 64.0 MiB of 64.0 MiB | 760.9 KiB/s |############################################################################################################################################################| 100% | ETA:  00:00:00Downloading SFD data file to /home/[-----]/my_libs_3/dustmaps_DATA_directory/sfd/SFD_dust_4096_sgp.fits
Downloading data to '/home/[-----]/my_libs_3/dustmaps_DATA_directory/sfd/SFD_dust_4096_sgp.fits' ...
Downloading https://dataverse.harvard.edu/api/access/datafile/2902695 ...
 64.0 MiB of 64.0 MiB |  88.2 KiB/s |############################################################################################################################################################| 100% | Time:  0:03:07
 64.0 MiB of 64.0 MiB | 685.6 KiB/s |############################################################################################################################################################| 100% | Time:  0:01:36

```

# adrn SFD

conda create --name py37_gaia_dr3_try1-adrn_sfd --clone py37_gaia_dr3_try1-naif


(SFDというディレクトリ名は紛らわしいので、adrn_SFDにする。)

```shell
$ cd ~/my_libs_3
$ git clone https://github.com/adrn/SFD.git adrn_SFD
$ cd adrn_SFD

```