Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions app/domain/dust.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from enum import Enum
from pathlib import Path

from astropy.coordinates import SkyCoord
from dustmaps.config import config

Check failure on line 5 in app/domain/dust.py

View workflow job for this annotation

GitHub Actions / tests

Import "dustmaps.config" could not be resolved (reportMissingImports)
from dustmaps.csfd import CSFDQuery

Check failure on line 6 in app/domain/dust.py

View workflow job for this annotation

GitHub Actions / tests

Import "dustmaps.csfd" could not be resolved (reportMissingImports)
from dustmaps.lenz2017 import Lenz2017Query

Check failure on line 7 in app/domain/dust.py

View workflow job for this annotation

GitHub Actions / tests

Import "dustmaps.lenz2017" could not be resolved (reportMissingImports)
from dustmaps.planck import PlanckQuery

Check failure on line 8 in app/domain/dust.py

View workflow job for this annotation

GitHub Actions / tests

Import "dustmaps.planck" could not be resolved (reportMissingImports)
from dustmaps.sfd import SFDQuery

Check failure on line 9 in app/domain/dust.py

View workflow job for this annotation

GitHub Actions / tests

Import "dustmaps.sfd" could not be resolved (reportMissingImports)


class DustMap(Enum):
SFD = SFDQuery
PLANCK = PlanckQuery
CSFD = CSFDQuery
LENZ2017 = Lenz2017Query


project_dir = Path(__file__).parent.resolve()
"""
Для локального запроса в директории с этим файлом создаём папку dust_maps и в неё скачиваем локальные карты
1) карта должна быть примерно по такому пути /db-app/app/domain/dust_maps/sfd/SFD_dust_4096_ngp.fits
скачать её можно командами в пайтон консоли

from dustmaps.config import config
config['data_dir'] = ('/Volumes/NVME 1TB/PyProjects/LEDA/app/domain/dust_maps') # нужно прописать свой путь

import dustmaps.sfd
dustmaps.sfd.fetch()

import dustmaps.csfd
dustmaps.csfd.fetch()

import dustmaps.planck
dustmaps.planck.fetch()

import dustmaps.lenz2017
dustmaps.lenz2017.fetch()
"""
config["data_dir"] = f"{project_dir}/dust_maps"

"""
1) coords = SkyCoord('12h30m25.3s', '15d15m58.1s', frame='icrs')

2) l = np.array([0., 90., 180.])
b = np.array([15., 0., -15.])
coords = SkyCoord(l, b, unit='deg', frame='galactic')

3) coords = SkyCoord(180., 0., unit='deg', frame='galactic')
"""


def get_absorption(coords: SkyCoord, map_type: DustMap = DustMap.SFD):
query = map_type.value()
return query(coords)
Loading