-
Notifications
You must be signed in to change notification settings - Fork 0
/
accutil_archive.py
582 lines (493 loc) · 23.6 KB
/
accutil_archive.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
'''
This is a collection of convenience functions for my specific purpose.
Most likely you have to write your very own convenience functions or
classes for your purposes.
'''
from pathlib import Path
import numpy as np
import pandas as pd
from astropy import units as u
from astropy.table import Table, vstack
from astropy.time import Time
from astropy.visualization import (ImageNormalize, LinearStretch,
ZScaleInterval, simple_norm)
from astroquery.jplhorizons import Horizons
from matplotlib.ticker import (FormatStrFormatter, LogFormatterSciNotation,
LogLocator, MultipleLocator, NullFormatter)
from scipy.interpolate import RectBivariateSpline
from scipy.interpolate import UnivariateSpline as USP
import yssbtmpy as tm
__all__ = ["QPRDIR", "CHEMDICT", "EPHEMPATH",
"PHYS_PHAE", "PHYS_PHAE_UP",
"QprbarSunSpline", "QprbarSpline",
"set_spl", "set_particle", "calc_traj",
"set_phaethon", "set_phaethon_up", "set_perpmodel", "set_model_aspect",
"znorm", "zimshow", "norm_imshow", "colorbaring",
"mplticker", "linticker", "logticker", "logxticker", "logyticker"
]
QPRDIR = Path("./data/Qpr")
CHEMDICT = dict(oliv="Olivine", mag="Magnetite")
EPHEMPATH = Path("./phae_ephem.csv")
# HanusJ+2018 A&A 620 L8
PHYS_PHAE = dict(spin_ecl_lon=318*u.deg, spin_ecl_lat=-47*u.deg,
rot_period=3.603957*u.h, p_vis=0.12, slope_par=0.15,
ti=600*tm.TIU, eta_beam=1, emissivity=0.9,
bulk_mass_den=1670*u.kg/u.m**3,
diam_eff=5.1*u.km,
diam_eq=5.1*u.km
)
# HanusJ+2018 A&A 620 L8
# Diameter from TaylorPA+2019 P&SS 167 1
PHYS_PHAE_UP = dict(spin_ecl_lon=318*u.deg, spin_ecl_lat=-47*u.deg,
rot_period=3.603957*u.h, p_vis=0.12, slope_par=0.15,
ti=600*tm.TIU, eta_beam=1, emissivity=0.9,
bulk_mass_den=1670*u.kg/u.m**3 * (5.1/6),
diam_eff=6*u.km,
diam_eq=6*u.km
)
# for bulk_mass_den, Yarkovsky effect gives rho ~ 1/D
class QprbarSunSpline:
def __init__(self, fpath):
rawdata = pd.read_csv(fpath)
rawarr = rawdata.to_numpy()[0][1:]
radii = np.array(rawdata.columns[1:]).astype(float)
self._spline = USP(radii, rawarr, k=3, s=0)
def get_value(self, r_um):
val_Qprbar = self._spline(r_um)
return val_Qprbar.flatten()
class QprbarSpline:
def __init__(self, fpath):
rawdata = pd.read_csv(fpath)
rawarr = rawdata.to_numpy()[:, 1:]
radii = np.array(rawdata.columns[1:]).astype(float)
self._spline = RectBivariateSpline(rawdata["T"], radii, rawarr,
kx=3, ky=3, s=0)
def get_value(self, T_K, r_um):
val_Qprbar = self._spline(T_K, r_um)
return val_Qprbar.flatten()
def set_spl(fpath=EPHEMPATH):
if not Path(fpath).exists():
epoch_ref = Time(2456049.8189178086, format='jd')
# perihelion: 2012-05-02T07:39:14.499
epochs_peri = epoch_ref + np.arange(-5, +5, 0.1) * u.day
epochs_long = dict(start=(epoch_ref - 300.01*u.day).isot,
stop=(epoch_ref + 300.01*u.day).isot,
step='1d')
obj_peri = Horizons(id=3200, epochs=epochs_peri.jd)
obj_long = Horizons(id=3200, epochs=epochs_long)
eph_peri = obj_peri.ephemerides()
eph_long = obj_long.ephemerides()
eph_all = vstack([eph_peri, eph_long])
eph_all.sort(keys="true_anom")
pos_ecl = tm.lonlat2cart(lon=eph_all["EclLon"], lat=eph_all["EclLat"])
spin_ecl = tm.lonlat2cart(lon=PHYS_PHAE["spin_ecl_lon"],
lat=PHYS_PHAE["spin_ecl_lat"])
_theta_asp = np.rad2deg(np.arccos(np.inner(pos_ecl.T, spin_ecl)))
eph_all["theta_asp"] = 180 - _theta_asp
eph_all.write(fpath)
eph_all = Table.read(fpath)
# as functions of true anomaly:
ks = dict(k=3, s=0)
spl_rh = USP(eph_all["true_anom"], eph_all["r"], **ks)
spl_asp = USP(eph_all["true_anom"], eph_all["theta_asp"], **ks)
spl_ro = USP(eph_all["true_anom"], eph_all["delta"], **ks)
spl_hlon = USP(eph_all["true_anom"], eph_all["EclLon"], **ks)
spl_hlat = USP(eph_all["true_anom"], eph_all["EclLat"], **ks)
spl_olon = USP(eph_all["true_anom"], eph_all["ObsEclLon"], **ks)
spl_olat = USP(eph_all["true_anom"], eph_all["ObsEclLat"], **ks)
spl_alpha = USP(eph_all["true_anom"], eph_all["alpha"], **ks)
return dict(rh=spl_rh, theta_asp=spl_asp, ro=spl_ro,
hlon=spl_hlon, hlat=spl_hlat,
olon=spl_olon, olat=spl_olat,
alpha=spl_alpha)
def set_phaethon(true_anom=0, ti=600, nlon=360, nlat=180,
fpath=EPHEMPATH):
spl = set_spl()
sb = tm.SmallBody()
sb.id = 3200
sb.set_ecl(r_hel=spl["rh"](true_anom),
hel_ecl_lon=spl["hlon"](true_anom),
hel_ecl_lat=spl["hlat"](true_anom),
r_obs=spl["ro"](true_anom), # dummy....
obs_ecl_lon=spl["olon"](true_anom),
obs_ecl_lat=spl["olat"](true_anom),
alpha=spl["alpha"](true_anom)
)
sb.set_spin(spin_ecl_lon=PHYS_PHAE["spin_ecl_lon"],
spin_ecl_lat=PHYS_PHAE["spin_ecl_lat"],
rot_period=PHYS_PHAE["rot_period"])
sb.set_optical(slope_par=PHYS_PHAE["slope_par"],
diam_eff=PHYS_PHAE["diam_eff"],
p_vis=PHYS_PHAE["p_vis"])
sb.set_mass(diam_eff=PHYS_PHAE["diam_eff"],
bulk_mass_den=PHYS_PHAE["bulk_mass_den"])
sb.set_thermal(ti=ti, emissivity=PHYS_PHAE["emissivity"])
sb.set_tpm(nlon=nlon, nlat=nlat, Zmax=10, nZ=50)
return sb
def set_phaethon_up(true_anom=0, ti=600, nlon=360, nlat=180,
fpath=EPHEMPATH):
spl = set_spl()
sb = tm.SmallBody()
sb.id = 3200
sb.set_ecl(r_hel=spl["rh"](true_anom),
hel_ecl_lon=spl["hlon"](true_anom),
hel_ecl_lat=spl["hlat"](true_anom),
r_obs=spl["ro"](true_anom), # dummy....
obs_ecl_lon=spl["olon"](true_anom),
obs_ecl_lat=spl["olat"](true_anom),
alpha=spl["alpha"](true_anom)
)
sb.set_spin(spin_ecl_lon=PHYS_PHAE_UP["spin_ecl_lon"],
spin_ecl_lat=PHYS_PHAE_UP["spin_ecl_lat"],
rot_period=PHYS_PHAE_UP["rot_period"])
sb.set_optical(slope_par=PHYS_PHAE_UP["slope_par"],
diam_eff=PHYS_PHAE_UP["diam_eff"],
p_vis=PHYS_PHAE_UP["p_vis"])
sb.set_mass(diam_eff=PHYS_PHAE_UP["diam_eff"],
bulk_mass_den=PHYS_PHAE_UP["bulk_mass_den"])
sb.set_thermal(ti=ti, emissivity=PHYS_PHAE_UP["emissivity"])
sb.set_tpm(nlon=nlon, nlat=nlat, Zmax=10, nZ=50)
return sb
def set_perpmodel(diam_eff, rot_period, r_hel=0.2,
a_bond=0.1, ti=200, bulk_mass_den=2000, emissivity=0.90,
nlon=360, nlat=180):
dummies = dict(r_obs=1, obs_ecl_lon=0, obs_ecl_lat=0, alpha=0)
sb = tm.SmallBody()
sb.set_ecl(r_hel=r_hel, hel_ecl_lon=0, hel_ecl_lat=0, **dummies)
sb.set_spin(spin_ecl_lon=0, spin_ecl_lat=90, rot_period=rot_period)
sb.set_optical(slope_par=0, a_bond=a_bond, diam_eff=diam_eff,
p_vis=tm.AG2p(a_bond, 0))
sb.set_mass(diam_eff=diam_eff, bulk_mass_den=bulk_mass_den)
sb.set_thermal(ti=ti, emissivity=emissivity)
sb.set_tpm(nlon=nlon, nlat=nlat, Zmax=10, nZ=50)
return sb
def set_model_aspect(diam_eff, rot_period, aspect_deg=90, r_hel=0.2,
a_bond=0.1, ti=200, bulk_mass_den=2000, emissivity=0.90,
nlon=360, nlat=180):
dummies = dict(r_obs=1, obs_ecl_lon=0, obs_ecl_lat=0, alpha=0)
sb = tm.SmallBody()
sb.set_ecl(r_hel=r_hel, hel_ecl_lon=0, hel_ecl_lat=0, **dummies)
sb.set_spin(spin_ecl_lon=0, spin_ecl_lat=aspect_deg, rot_period=rot_period)
sb.set_optical(slope_par=0, a_bond=a_bond, diam_eff=diam_eff,
p_vis=tm.AG2p(a_bond, 0))
sb.set_mass(diam_eff=diam_eff, bulk_mass_den=bulk_mass_den)
sb.set_thermal(ti=ti, emissivity=emissivity)
sb.set_tpm(nlon=nlon, nlat=nlat, Zmax=10, nZ=50)
return sb
def set_particle(smallbody, radius_um, chem, init_th, init_ph,
init_height=1*u.cm, mass_den=3000*u.kg/u.m**3, r0_radius=0.01):
Qprbar_sun = QprbarSunSpline(QPRDIR/f"Qprbar_sun_{chem}.csv")
Qprbar_ther = QprbarSpline(QPRDIR/f"Qprbar_{chem}.csv")
particle = tm.MovingParticle(smallbody=smallbody,
radius=radius_um*u.um,
mass_den=mass_den,
r0_radius=r0_radius)
particle.set_func_Qprbar(func_Qprbar=Qprbar_ther.get_value,
func_Qprbar_sun=Qprbar_sun.get_value)
particle.set_initial_pos(init_th, init_ph, height=init_height)
return particle
def calc_traj(chem, radius, sb, init_th, init_ph, max_h_step, nstep=np.inf,
min_height=0.1*u.cm, init_height=1*u.cm, r0_radius=0.01,
mass_den=3000*u.kg/u.m**3, dt=0.1):
particle = set_particle(sb, radius, chem, init_th, init_ph,
init_height=init_height, mass_den=mass_den,
r0_radius=r0_radius)
sb_radius = sb.diam_eff.to(u.m).value / 2
sb_GM = tm.GG * sb.mass.to(u.kg).value
max_h = max_h_step
if max_h is not None:
while True:
PROP_KW = dict(dt=dt, verbose=False, nstep=nstep,
min_height=min_height, max_height=max_h)
particle.propagate(**PROP_KW)
if particle.halt_code == 'max_height':
rvec = particle.trace_rvec[-1]
r = particle.trace_pos_sph[-1][0]
vel_last = particle.trace_vel_xyz[-1]
spd_last = np.linalg.norm(vel_last)
vel_r = np.sum(rvec*vel_last)
vel_esc = np.sqrt(2*sb_GM/r)
psi_ang = np.arccos(-1*vel_r/spd_last)
psi_crit = np.arcsin(sb_radius / r)
t_last = particle.trace_time[-1]
if (spd_last > vel_esc) and (psi_ang > psi_crit):
break
# particle.halt_code_str_2 = 'escape_speed'
elif t_last > dt*nstep:
break
# particle.halt_code_str_2 = 'max_time'
else:
max_h += max_h_step
else:
break
else:
PROP_KW = dict(dt=dt, verbose=False, nstep=nstep,
min_height=min_height, max_height=None)
particle.propagate(**PROP_KW)
particle.wrapup()
return particle
########################################################################
# Below are from ysfitsutilpy.visutil module from version 2019-09-14,
# commit number bc3e0b7037a1a4a766972abe053acc22c7e4b016
########################################################################
def znorm(image, stretch=LinearStretch(), **kwargs):
return ImageNormalize(image,
interval=ZScaleInterval(**kwargs),
stretch=stretch)
def zimshow(ax, image, stretch=LinearStretch(), cmap=None, **kwargs):
im = ax.imshow(image,
norm=znorm(image, stretch=stretch, **kwargs),
origin='lower',
cmap=cmap)
return im
def norm_imshow(ax, data, stretch='linear', power=1.0, asinh_a=0.1,
min_cut=None, max_cut=None, min_percent=None, max_percent=None,
percent=None, clip=True, log_a=1000, **kwargs):
""" Do normalization and do imshow
"""
norm = simple_norm(data, stretch=stretch, power=power, asinh_a=asinh_a,
min_cut=min_cut, max_cut=max_cut,
min_percent=min_percent, max_percent=max_percent,
percent=percent, clip=clip, log_a=log_a)
im = ax.imshow(data, norm=norm, origin='lower', **kwargs)
return im
def colorbaring(fig, ax, im, fmt="%.0f", orientation='horizontal',
formatter=FormatStrFormatter, **kwargs):
cb = fig.colorbar(im, ax=ax, orientation=orientation,
format=FormatStrFormatter(fmt), **kwargs)
return cb
def mplticker(ax_list,
xmajlocators=None, xminlocators=None,
ymajlocators=None, yminlocators=None,
xmajformatters=None, xminformatters=None,
ymajformatters=None, yminformatters=None,
xmajgrids=True, xmingrids=True,
ymajgrids=True, ymingrids=True,
xmajlockws=None, xminlockws=None,
ymajlockws=None, yminlockws=None,
xmajfmtkws=None, xminfmtkws=None,
ymajfmtkws=None, yminfmtkws=None,
xmajgridkws=dict(ls='-', alpha=0.5),
xmingridkws=dict(ls=':', alpha=0.5),
ymajgridkws=dict(ls='-', alpha=0.5),
ymingridkws=dict(ls=':', alpha=0.5)):
''' Set tickers of Axes objects.
Note
----
Notation of arguments is <axis><which><name>. <axis> can be ``x`` or
``y``, and <which> can be ``major`` or ``minor``.
For example, ``xmajlocators`` is the Locator object for x-axis
major. ``kw`` means the keyword arguments that will be passed to
locator, formatter, or grid.
If a single object is given for locators, formatters, grid, or kw
arguments, it will basically be copied by the number of Axes objects
and applied identically through all the Axes.
Parameters
----------
ax_list : Axes or 1-d array-like of such
The Axes object(s).
locators : Locator, None, list of such, optional
The Locators used for the ticker. Must be a single Locator
object or a list of such with the identical length of
``ax_list``.
If ``None``, the default locator is not touched.
formatters : Formatter, None, False, array-like of such, optional
The Formatters used for the ticker. Must be a single Formatter
object or an array-like of such with the identical length of
``ax_list``.
If ``None``, the default formatter is not touched.
If ``False``, the labels are not shown (by using the trick
``FormatStrFormatter(fmt="")``).
grids : bool, array-like of such, optinoal.
Whether to draw the grid lines. Must be a single bool object or
an array-like of such with the identical length of ``ax_list``.
lockws : dict, array-like of such, array-like, optional
The keyword arguments that will be passed to the ``locators``.
If it's an array-like but elements are not dict, it is
interpreted as ``*args`` passed to locators.
If it is (or contains) dict, it must be a single dict object or
an array-like object of such with the identical length of
``ax_list``.
Set as empty dict (``{}``) if you don't want to change the
default arguments.
fmtkws : dict, str, list of such, optional
The keyword arguments that will be passed to the ``formatters``.
If it's an array-like but elements are not dict, it is
interpreted as ``*args`` passed to formatters.
If it is (or contains) dict, it must be a single dict object or
an array-like object of such with the identical length of
``ax_list``.
Set as empty dict (``{}``) if you don't want to change the
default arguments.
gridkw : dict, list of such, optional
The keyword arguments that will be passed to the grid. Must be a
single dict object or a list of such with the identical length
of ``ax_list``.
Set as empty dict (``{}``) if you don't want to change the
default arguments.
'''
def _check(obj, name, n):
arr = np.atleast_1d(obj)
n_arr = arr.shape[0]
if n_arr not in [1, n]:
raise ValueError(f"{name} must be a single object or a 1-d array"
+ f" with the same length as ax_list ({n}).")
else:
newarr = arr.tolist() * (n//n_arr)
return newarr
def _setter(setter, Setter, kw):
# don't do anything if obj (Locator or Formatter) is None:
if (Setter is not None) and (kw is not None):
# matplotlib is so poor in log plotting....
if (Setter == LogLocator) and ("numticks" not in kw):
kw["numticks"] = 50
if isinstance(kw, dict):
setter(Setter(**kw))
else: # interpret as ``*args``
setter(Setter(*(np.atleast_1d(kw).tolist())))
# except:
# raise ValueError("Error occured for Setter={} with input {}"
# .format(Setter, kw))
_ax_list = np.atleast_1d(ax_list)
if _ax_list.ndim > 1:
raise ValueError("ax_list must be at most 1-d.")
n_axis = _ax_list.shape[0]
_xmajlocators = _check(xmajlocators, "xmajlocators", n_axis)
_xminlocators = _check(xminlocators, "xminlocators", n_axis)
_ymajlocators = _check(ymajlocators, "ymajlocators", n_axis)
_yminlocators = _check(yminlocators, "yminlocators", n_axis)
_xmajformatters = _check(xmajformatters, "xmajformatters ", n_axis)
_xminformatters = _check(xminformatters, "xminformatters ", n_axis)
_ymajformatters = _check(ymajformatters, "ymajformatters", n_axis)
_yminformatters = _check(yminformatters, "yminformatters", n_axis)
_xmajlockws = _check(xmajlockws, "xmajlockws", n_axis)
_xminlockws = _check(xminlockws, "xminlockws", n_axis)
_ymajlockws = _check(ymajlockws, "ymajlockws", n_axis)
_yminlockws = _check(yminlockws, "yminlockws", n_axis)
_xmajfmtkws = _check(xmajfmtkws, "xmajfmtkws", n_axis)
_xminfmtkws = _check(xminfmtkws, "xminfmtkws", n_axis)
_ymajfmtkws = _check(ymajfmtkws, "ymajfmtkws", n_axis)
_yminfmtkws = _check(yminfmtkws, "yminfmtkws", n_axis)
_xmajgrids = _check(xmajgrids, "xmajgrids", n_axis)
_xmingrids = _check(xmingrids, "xmingrids", n_axis)
_ymajgrids = _check(ymajgrids, "ymajgrids", n_axis)
_ymingrids = _check(ymingrids, "ymingrids", n_axis)
_xmajgridkws = _check(xmajgridkws, "xmajgridkws", n_axis)
_xmingridkws = _check(xmingridkws, "xmingridkws", n_axis)
_ymajgridkws = _check(ymajgridkws, "ymajgridkws", n_axis)
_ymingridkws = _check(ymingridkws, "ymingridkws", n_axis)
for i, aa in enumerate(_ax_list):
_xmajlocator = _xmajlocators[i]
_xminlocator = _xminlocators[i]
_ymajlocator = _ymajlocators[i]
_yminlocator = _yminlocators[i]
_xmajformatter = _xmajformatters[i]
_xminformatter = _xminformatters[i]
_ymajformatter = _ymajformatters[i]
_yminformatter = _yminformatters[i]
_xmajgrid = _xmajgrids[i]
_xmingrid = _xmingrids[i]
_ymajgrid = _ymajgrids[i]
_ymingrid = _ymingrids[i]
_xmajlockw = _xmajlockws[i]
_xminlockw = _xminlockws[i]
_ymajlockw = _ymajlockws[i]
_yminlockw = _yminlockws[i]
_xmajfmtkw = _xmajfmtkws[i]
_xminfmtkw = _xminfmtkws[i]
_ymajfmtkw = _ymajfmtkws[i]
_yminfmtkw = _yminfmtkws[i]
_xmajgridkw = _xmajgridkws[i]
_xmingridkw = _xmingridkws[i]
_ymajgridkw = _ymajgridkws[i]
_ymingridkw = _ymingridkws[i]
_setter(aa.xaxis.set_major_locator, _xmajlocator, _xmajlockw)
_setter(aa.xaxis.set_minor_locator, _xminlocator, _xminlockw)
_setter(aa.yaxis.set_major_locator, _ymajlocator, _ymajlockw)
_setter(aa.yaxis.set_minor_locator, _yminlocator, _yminlockw)
_setter(aa.xaxis.set_major_formatter, _xmajformatter, _xmajfmtkw)
_setter(aa.xaxis.set_minor_formatter, _xminformatter, _xminfmtkw)
_setter(aa.yaxis.set_major_formatter, _ymajformatter, _ymajfmtkw)
_setter(aa.yaxis.set_minor_formatter, _yminformatter, _yminfmtkw)
# Strangely, using ``b=_xmingrid`` does not work if it is
# False... I had to do it manually like this... OMG matplotlib..
if _xmajgrid:
aa.grid(axis='x', which='major', **_xmajgridkw)
if _xmingrid:
aa.grid(axis='x', which='minor', **_xmingridkw)
if _ymajgrid:
aa.grid(axis='y', which='major', **_ymajgridkw)
if _ymingrid:
aa.grid(axis='y', which='minor', **_ymingridkw)
def linticker(ax_list,
xmajlocators=MultipleLocator, xminlocators=MultipleLocator,
ymajlocators=MultipleLocator, yminlocators=MultipleLocator,
xmajformatters=FormatStrFormatter,
xminformatters=NullFormatter,
ymajformatters=FormatStrFormatter,
yminformatters=NullFormatter,
xmajgrids=True, xmingrids=True,
ymajgrids=True, ymingrids=True,
xmajlockws=None, xminlockws=None,
ymajlockws=None, yminlockws=None,
xmajfmtkws=None, xminfmtkws={},
ymajfmtkws=None, yminfmtkws={},
xmajgridkws=dict(ls='-', alpha=0.5),
xmingridkws=dict(ls=':', alpha=0.5),
ymajgridkws=dict(ls='-', alpha=0.5),
ymingridkws=dict(ls=':', alpha=0.5)):
mplticker(**locals())
def logticker(ax_list,
xmajlocators=LogLocator, xminlocators=LogLocator,
ymajlocators=LogLocator, yminlocators=LogLocator,
xmajformatters=LogFormatterSciNotation,
xminformatters=NullFormatter,
ymajformatters=LogFormatterSciNotation,
yminformatters=NullFormatter,
xmajgrids=True, xmingrids=True,
ymajgrids=True, ymingrids=True,
xmajlockws=None, xminlockws=None,
ymajlockws=None, yminlockws=None,
xmajfmtkws=None, xminfmtkws={},
ymajfmtkws=None, yminfmtkws={},
xmajgridkws=dict(ls='-', alpha=0.5),
xmingridkws=dict(ls=':', alpha=0.5),
ymajgridkws=dict(ls='-', alpha=0.5),
ymingridkws=dict(ls=':', alpha=0.5)):
mplticker(**locals())
def logxticker(ax_list,
xmajlocators=LogLocator, xminlocators=LogLocator,
ymajlocators=MultipleLocator, yminlocators=MultipleLocator,
xmajformatters=LogFormatterSciNotation,
xminformatters=NullFormatter,
ymajformatters=FormatStrFormatter,
yminformatters=NullFormatter,
xmajgrids=True, xmingrids=True,
ymajgrids=True, ymingrids=True,
xmajlockws=None, xminlockws=None,
ymajlockws=None, yminlockws=None,
xmajfmtkws=None, xminfmtkws={},
ymajfmtkws=None, yminfmtkws={},
xmajgridkws=dict(ls='-', alpha=0.5),
xmingridkws=dict(ls=':', alpha=0.5),
ymajgridkws=dict(ls='-', alpha=0.5),
ymingridkws=dict(ls=':', alpha=0.5)):
mplticker(**locals())
def logyticker(ax_list,
xmajlocators=MultipleLocator, xminlocators=MultipleLocator,
ymajlocators=LogLocator, yminlocators=LogLocator,
xmajformatters=FormatStrFormatter,
xminformatters=NullFormatter,
ymajformatters=LogFormatterSciNotation,
yminformatters=NullFormatter,
xmajgrids=True, xmingrids=True,
ymajgrids=True, ymingrids=True,
xmajlockws=None, xminlockws=None,
ymajlockws=None, yminlockws=None,
xmajfmtkws=None, xminfmtkws={},
ymajfmtkws=None, yminfmtkws={},
xmajgridkws=dict(ls='-', alpha=0.5),
xmingridkws=dict(ls=':', alpha=0.5),
ymajgridkws=dict(ls='-', alpha=0.5),
ymingridkws=dict(ls=':', alpha=0.5)):
mplticker(**locals())