<jupyter_start><jupyter_text>High-Velocity Clouds All-Sky MapFigure 8.1 from Chapter 8 of *Interstellar and Intergalactic Medium* by <NAME>, 2021, Cambridge University Press.Version of the HI4PI Survey HVC N$_{HI}$ map of [Westmeier 2018, MNRAS, 474, 289](https://ui.adsabs.harvard.edu/abs/2018MNRAS.474..289W/abstract), Figure a1, using the FITS data from <NAME>'s website (with permission): [www.atnf.csiro.au/people/Tobias.Westmeier/research_hvcsky.php](https://www.atnf.csiro.au/people/Tobias.Westmeier/research_hvcsky.phpdownload).The map is a ~4Kx2K FITS file in Cartesian coordinates with pixels in units of $\log(N_{HI}/cm^{-2})$.  Hispaper presented the map in an Aitoff projection with a heatmap color mapping, but we transform it to a Mollweideprojection like all of the other all-sky maps in the book, and use a grayscale to represent the data.Unlike the other all-sky maps, however, this Mollweide projection is centered on the **galactic anticenter**.Note that unlike the other all-sky maps we've been working with, Tobias does not provide his data in HEALPixformat, so we have to project the Cartesian data.<jupyter_code>%matplotlib inline

import matplotlib
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator, LogLocator, NullFormatter

from astropy.io import fits
import numpy as np

import warnings
warnings.filterwarnings('ignore',category=UserWarning, append=True)<jupyter_output><empty_output><jupyter_text>Standard Plot FormatSetup the standard plotting format and make the plot. Fonts and resolution adopted follow CUP style.<jupyter_code>figName = 'Fig8_1' 

# graphic aspect ratio = width/height

aspect = 4.0/3.0 # 4:3

# Text width in inches - don't change, this is defined by the print layout

textWidth = 6.0 # inches

# output format and resolution

figFmt = 'jpg'
dpi = 600

# Graphic dimensions 

plotWidth = dpi*textWidth
plotHeight = plotWidth/aspect
axisFontSize = 10
labelFontSize = 8
lwidth = 0.5
axisPad = 5
wInches = textWidth 
hInches = wInches/aspect

# Plot filename

plotFile = f'{figName}.{figFmt}'

# LaTeX is used throughout for markup of symbols, Times-Roman serif font

plt.rc('text', usetex=True)
plt.rc('font', **{'family':'serif','serif':['Times-Roman'],'weight':'bold','size':'16'})

# Font and line weight defaults for axes

matplotlib.rc('axes',linewidth=lwidth)
matplotlib.rcParams.update({'font.size':axisFontSize})

# axis and label padding

plt.rcParams['xtick.major.pad'] = f'{axisPad}'
plt.rcParams['ytick.major.pad'] = f'{axisPad}'
plt.rcParams['axes.labelpad'] = f'{axisPad}'<jupyter_output><empty_output><jupyter_text>HI4PI All Sky 21-cm N$_{HI}$ map of HVCsData are Cartesian coordinates, project to Mollweide.  Plot $log_{10}(N_{HI})$ from 18 to 21.  No grid, andlabel the LMC, SMC, and the Magellanic Stream (MS).The projection takes a few minutes to complete.<jupyter_code>mapFile = 'hi4pi-hvc-nhi-gal-car.fits'

fitsFile = fits.open(mapFile)

hvcMap = fitsFile[0].data
naxis1 = fitsFile[0].header['naxis1']
naxis2 = fitsFile[0].header['naxis2']

# meshgrid for the image

lon = np.linspace(-np.pi,np.pi,naxis1)
lat = np.linspace(-np.pi/2,np.pi/2,naxis2)
mapLon,mapLat = np.meshgrid(lon,lat)

# log column density range (cm^-2)

minNHI = 18
maxNHI = 21

# Make the plot

fig,ax = plt.subplots()
fig.set_dpi(dpi)
fig.set_size_inches(wInches,hInches,forward=True)

ax=plt.axes(projection='mollweide')

ax.xaxis.set_ticklabels([]) 
ax.yaxis.set_ticklabels([])

im = ax.pcolormesh(mapLon,mapLat,hvcMap,cmap='Greys',vmin=minNHI,vmax=maxNHI)

# Label LMC, SMC, and Magellanic Stream

plt.text(np.radians(-90),np.radians(-32),'LMC',ha='left',va='center',fontsize=10)
plt.text(np.radians(-130),np.radians(-42),'SMC',ha='right',va='center',fontsize=10)
plt.text(np.radians(-60),np.radians(-70),'MS',ha='right',va='center',fontsize=10)
plt.text(np.radians(66),np.radians(-70),'MS',ha='left',va='center',fontsize=10)

# make the file

plt.plot()
plt.savefig(plotFile,bbox_inches='tight')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13375, 'fraction_numerical': 0.026, 'mean_word_length': 5.922145328719723, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '176318', 'license': 'CC0-1.0', 'n_tokens_mistral': 1529, 'n_tokens_neox': 1421, 'n_words': 359, 'path': 'Chapter8/Fig8_1_HVCs_NHI_AllSky.ipynb', 'repo_name': 'CambridgeUniversityPress/Interstellar-and-Intergalactic-Medium', 'size': '4017'}