- To decide on a process for selecting CoC for matplotlib
- Proposed CoC was opened at matplotlib/matplotlib#18538
| def calculate_derivs(positions, t, m_sun, m_planet, G): | |
| # Unpack positions and velocities | |
| asteroid_x = positions[0] | |
| asteroid_vx = positions[1] | |
| asteroid_y = positions[2] | |
| asteroid_vy = positions[3] | |
| sun_x = positions[0] | |
| sun_vx = positions[1] | |
| sun_y = positions[2] |
| npools = 4 | |
| inputs = [] | |
| for i in range(npools): | |
| inputs.append((rs[i::npools], T_perps_0[i::npools], T_pars_0[i::npools], | |
| vs[i::npools], ns[i::npools])) | |
| # multiprocessing pool | |
| with Pool(npools) as p: | |
| anis = p.map(single_tani, inputs) |
| import matplotlib | |
| matplotlib.use('qt5agg') | |
| import matplotlib.pyplot as plt | |
| import matplotlib.widgets as mwidgets | |
| from datetime import datetime, timedelta | |
| import numpy as np | |
| import astropy.units as u | |
| import astropy.constants as const | |
| from astropy.visualization import quantity_support |
| from parfive import Downloader | |
| for i in range(10, 20): | |
| dl = Downloader() | |
| dl.enqueue_file(f"https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/mag_rtn_1min/2018/psp_fld_l2_mag_rtn_1min_201811{i:02}_v01.cdf", path="./") | |
| result = dl.download() | |
| if len(result.errors): | |
| raise result.errors[0][2] |
| self.m.meta['CTYPE1'] = 'CRLN-CEA' | |
| self.m.meta['CTYPE2'] = 'CRLT-CEA' | |
| self.m.meta['CDELT1'] = np.abs(self.m.meta['CDELT1']) | |
| self.m.meta['CDELT2'] = 180 / np.pi * self.m.meta['CDELT2'] | |
| self.m.meta['CRVAL1'] = 0.0 | |
| self.m.meta['CUNIT1'] = 'deg' | |
| self.m.meta['CUNIT2'] = 'deg' | |
| self.m.meta['date-obs'] = parse_time(self.m.meta['t_start']).isot |
| import matplotlib.pyplot as plt | |
| from reproject import reproject_interp | |
| import sunpy.data.sample | |
| import sunpy.map | |
| map_aia = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE) | |
| map_hmi = sunpy.map.Map(sunpy.data.sample.HMI_LOS_IMAGE) | |
| map_hmi.plot_settings['cmap'] = "hmimag" |
| import matplotlib.pyplot as plt | |
| import astropy.units as u | |
| from astropy.coordinates import SkyCoord | |
| from matplotlib.patches import Rectangle | |
| import sunpy.data.sample | |
| import sunpy.map | |
| aia_map = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE) |
| def load_data(files): | |
| # Number of data points for each variable and time | |
| npoints = 360 * 180 | |
| # Variable names | |
| variables = ['lons', 'lats', 'b_all', 'b_feet', 'b_ss'] | |
| # Empty array to store data | |
| all_data = np.zeros((len(variables), len(files), npoints)) * np.nan | |
| dtimes = [] |