I believe that fixing this will be relatively simple, but I cannot figure out how to collapse the scatter plot that I built in python.
I have 2 datasets, one of galactic latitudes and one of galactic longitudes, and I built them with a hammer projection to represent the distribution of stars in galactic coordinates.
Now I want to use the smoothing of cars to smooth the graph with 15-degree boxes. I tried using astropy.convolution with convolve and Box2DKernel, but I can't get it to work. I also looked at examples from http://docs.astropy.org/en/stable/convolution/kernels.html
but I don’t understand how to translate their examples to what I need to do. They seem to be building a 2D function and smoothing it out. Can I not minimize the plot and beat the points where they are on the chart? The only thing I got to show something is creating a straight line, and I don’t understand why. I am very new to python, so this gave me a ton of problems.
This is the code that I still have:
This maps two arrays to the hammer projection:
from astropy import units as u
import astropy.coordinates as coord
glat = coord.Angle(pos_data['GLAT']*u.degree)
glon = coord.Angle(pos_data['GLON']*u.degree)
glon= glon.wrap_at(180*u.degree)
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(10,12))
ax = fig.add_subplot(211, projection="hammer")
ax.scatter(glon.radian, glat.radian)
ax.grid(True)
This is my attempt to collapse data:
from astropy.convolution import convolve, Box2DKernel
data = [glon, glat]
kernel = Box2DKernel(10)
smoothed = convolve(data, kernel)
ax = fig.add_subplot(212, projection="hammer")
ax.scatter(smoothed[0]*u.radian, smoothed[1]*u.radian)
ax.grid(True)
, , - , , . ( ), "" , , 1D- .
, .