cosmic-popsynth 3.4.17__cp310-cp310-macosx_14_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cosmic/plotting.py ADDED
@@ -0,0 +1,683 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) Katelyn Breivik (2017 - 2021)
3
+ #
4
+ # This file is part of cosmic.
5
+ #
6
+ # cosmic is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # cosmic is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with cosmic. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ """`plotting`
20
+ """
21
+
22
+ import numpy as np
23
+ import pandas as pd
24
+ import matplotlib.pyplot as plt
25
+ import matplotlib.gridspec as gridspec
26
+ import matplotlib.patches as mpatches
27
+
28
+ from matplotlib.lines import Line2D
29
+ from .utils import a_from_p, calc_Roche_radius
30
+ from .evolve import Evolve
31
+
32
+ __author__ = "Jeff Andrews <andrews.jeff@gmail.com>"
33
+ __all__ = [
34
+ "evolve_binary",
35
+ "plot_k_type",
36
+ "plot_radius",
37
+ "plot_mass",
38
+ "plot_Teff",
39
+ "plot_Mdot",
40
+ "plot_P_orb",
41
+ "plot_ecc",
42
+ "plot_HR_diagram",
43
+ "plot_binary_evol",
44
+ "evolve_and_plot",
45
+ ]
46
+
47
+ rsun_in_au = 215.0954
48
+ day_in_year = 365.242
49
+
50
+ # Colors
51
+ primary_color = "C0"
52
+ secondary_color = "C1"
53
+
54
+
55
+ def evolve_binary(initC, t_min=None, t_max=None, BSEDict={}):
56
+ """
57
+ Evolves a single binary with all timesteps written
58
+ to the bcm array for plotting
59
+
60
+ Parameters
61
+ ----------
62
+ initC : `pandas.DataFrame`
63
+ initial conditions for binary to evolve
64
+
65
+ t_min : `float`
66
+ starting time for plot in Myr
67
+
68
+ t_max : `float`
69
+ ending time for plot in Myr
70
+
71
+ BSEDict : `Dict`
72
+ Dictionary containing all BSE flags needed
73
+
74
+ Returns
75
+ -------
76
+ bcm : `pandas.DataFrame`
77
+ binary evolution data form BSE's bcm dict
78
+ """
79
+
80
+ # Disable chained warning for now which throws
81
+ # a warning for setting dtp and tphysf
82
+ pd.options.mode.chained_assignment = None
83
+
84
+ # Get highest BSE temporal resolution
85
+ BSEDict["dtp"] = 0.01
86
+
87
+ # To deal with the limited size of the bcm array, we need to reduce
88
+ # the time resolution if we are evolving a binary for more than 100 Myr
89
+ if t_max is not None:
90
+ if t_min is not None:
91
+ if t_max - t_min > 100:
92
+ BSEDict["dtp"] = (t_max - t_min) / 10000
93
+ else:
94
+ if t_max > 100:
95
+ BSEDict["dtp"] = t_max / 10000
96
+
97
+ # Set maximum time for evolution
98
+ if t_max is not None:
99
+ initC["tphysf"] = t_max
100
+
101
+ # Call evolution scripts
102
+ bpp, bcm, initC, kick_info = Evolve.evolve(
103
+ initialbinarytable=initC, BSEDict=BSEDict
104
+ )
105
+
106
+ # In case minimum and maximum times are not supplied by user
107
+ if t_min is None:
108
+ # BUG HERE - BSE sets first value to weird float
109
+ # HACKED FIX
110
+ t_phys = np.array(bcm.tphys)
111
+ t_phys[0] = 0.0
112
+ bcm.at[0, "tphys"] = t_phys
113
+ t_min = bcm.tphys.min()
114
+ if t_max is None:
115
+ t_max = bcm.tphys.max()
116
+
117
+ # Select for temporal range
118
+ bcm = bcm.loc[(bcm.tphys <= t_max) & (bcm.tphys >= t_min)]
119
+
120
+ return bcm
121
+
122
+
123
+ def plot_k_type(ax_1, ax_2, ax_k_type_list, times, k1_out, k2_out,
124
+ k_type_colors=None, k_type_labels=None):
125
+ """Plots the stellar types as a function of time
126
+
127
+ Parameters
128
+ ----------
129
+ ax_1 : `matplotlib.Axes`
130
+ Axis instance for kstar 1
131
+
132
+ ax_2 : `matplotlib.Axes`
133
+ Axis instance for kstar 2
134
+
135
+ ax_k_type_list : `list`
136
+ List of ktypes for the legend of the ktype bar plots
137
+
138
+ times : `pandas.Series`
139
+ Series of times at each binary evolution time step in Myr
140
+
141
+ k1_out : `pandas.Series`
142
+ Series of kstar 1 type at each binary evolution time step in Myr
143
+
144
+ k2_out : `pandas.Series`
145
+ Series of kstar 2 type at each binary evolution time step in Myr
146
+
147
+ k_type_colors : `list`
148
+ List of colors for each ktype
149
+
150
+ k_type_labels : `list`
151
+ List of labels for each ktype
152
+
153
+ Returns
154
+ -------
155
+ Null
156
+ """
157
+
158
+ k_type_colors = [
159
+ "plum",
160
+ "sandybrown",
161
+ "lightseagreen",
162
+ "moccasin",
163
+ "chartreuse",
164
+ "deepskyblue",
165
+ "gold",
166
+ "rosybrown",
167
+ "m",
168
+ "darkgreen",
169
+ "grey",
170
+ "sienna",
171
+ "palevioletred",
172
+ "navy",
173
+ "tan",
174
+ "black",
175
+ ] if k_type_colors is None else k_type_colors
176
+ k_type = [
177
+ "MS conv",
178
+ "MS",
179
+ "HG",
180
+ "GB",
181
+ "CHeB",
182
+ "EAGB",
183
+ "TPAGB",
184
+ "HeMS",
185
+ "HeHG",
186
+ "HeGB",
187
+ "HeWD",
188
+ "COWD",
189
+ "ONeWD",
190
+ "NS",
191
+ "BH",
192
+ "no remnant",
193
+ ] if k_type_labels is None else k_type_labels
194
+
195
+ # k-type plots
196
+ for a in [ax_1, ax_2]:
197
+
198
+ a.axis("off")
199
+
200
+ for j, k in enumerate(np.unique(k1_out)):
201
+ a.fill_between(times[k1_out == k], 0.7, 0.9, color=k_type_colors[k])
202
+ for j, k in enumerate(np.unique(k2_out)):
203
+ a.fill_between(times[k2_out == k], 0.4, 0.6, color=k_type_colors[k])
204
+
205
+ a.set_title("Stellar Type")
206
+
207
+ a.set_xlim(np.min(times), np.max(times))
208
+
209
+ # Add legend
210
+ ax_k_type_list.axis("off")
211
+ k_type_all = np.unique(np.array([k1_out, k2_out]))
212
+ patches = [
213
+ mpatches.Patch(color=k_type_colors[k], label=k_type[k]) for k in k_type_all
214
+ ]
215
+ leg = ax_k_type_list.legend(handles=patches, mode="expand", ncol=len(k_type_all))
216
+ leg.get_frame().set_alpha(0.0)
217
+
218
+
219
+ def plot_radius(
220
+ ax, times, R1_out, R2_out, M1_out, M2_out, P_orb_out, ecc_out, sys_obs, legend=True
221
+ ):
222
+ """Plots the stellar radii as a function of time
223
+
224
+ Parameters
225
+ ----------
226
+ ax : `matplotlib.Axes`
227
+ Axis instance for the plot
228
+
229
+ times : `pandas.Series`
230
+ Series of times at each binary evolution time step in Myr
231
+
232
+ R1_out : `pandas.Series`
233
+ Series of primary radius at each binary evolution time step in Rsun
234
+
235
+ R2_out : `pandas.Series`
236
+ Series of secondary radius at each binary evolution time step in Rsun
237
+
238
+ M1_out : `pandas.Series`
239
+ Series of primary mass at each binary evolution time step in Msun
240
+
241
+ M2_out : `pandas.Series`
242
+ Series of secondary mass at each binary evolution time step in Msun
243
+
244
+ P_orb_out : `pandas.Series`
245
+ Series of orbital periods at each binary evolution time step in days
246
+
247
+ ecc_out : `pandas.Series`
248
+ Series of eccentricities at each binary evolution time step
249
+
250
+ sys_obs : `Dict`
251
+ Dictionary containing keys for binary parameters with values to plot
252
+ as vertical lines for each stellar component
253
+
254
+ Returns
255
+ -------
256
+ Null
257
+ """
258
+ # Radius
259
+ ax.plot(times, R1_out, color=primary_color)
260
+ ax.plot(times, R2_out, color=secondary_color)
261
+
262
+ # Plot Roche radii - at periastron
263
+ A_out = a_from_p(M1_out, M2_out, P_orb_out) # in Rsun
264
+ R1_Roche = calc_Roche_radius(M1_out, M2_out, A_out * (1.0 - ecc_out)) # in Rsun
265
+ R2_Roche = calc_Roche_radius(M2_out, M1_out, A_out * (1.0 - ecc_out)) # in Rsun
266
+ ax.plot(times, R1_Roche, color=primary_color, linestyle="--")
267
+ ax.plot(times, R2_Roche, color=secondary_color, linestyle="--")
268
+
269
+ for key, value in sys_obs.items():
270
+ if key == "R1":
271
+ ax.axhline(value, color=primary_color, linestyle="dashed")
272
+ if key == "R2":
273
+ ax.axhline(value, color=secondary_color, linestyle="dashed")
274
+
275
+ ax.set_yscale("log")
276
+ ax.set_ylim(0.5, ax.get_ylim()[1])
277
+
278
+ ax.set_ylabel(r"Radius ($R_{\odot}$)")
279
+
280
+ ax.set_xlim(np.min(times), np.max(times))
281
+
282
+ if legend:
283
+ custom_lines = [
284
+ Line2D([0], [0], color="k", linestyle="solid"),
285
+ Line2D([0], [0], color="k", linestyle="dashed"),
286
+ ]
287
+ ax.legend(custom_lines, ["Stellar Radius", "Roche Radius"], frameon=False)
288
+
289
+
290
+ def plot_mass(ax, times, M1_out, M2_out, sys_obs):
291
+ """Plots the stellar mass as a function of time
292
+
293
+ Parameters
294
+ ----------
295
+ ax : `matplotlib.Axes`
296
+ Axis instance for the plot
297
+
298
+ times : `pandas.Series`
299
+ Series of times at each binary evolution time step in Myr
300
+
301
+ M1_out : `pandas.Series`
302
+ Series of primary mass at each binary evolution time step in Msun
303
+
304
+ M2_out : `pandas.Series`
305
+ Series of secondary mass at each binary evolution time step in Msun
306
+
307
+ sys_obs : `Dict`
308
+ Dictionary containing keys for binary parameters with values to plot
309
+ as vertical lines for each stellar component
310
+
311
+ Returns
312
+ -------
313
+ Null
314
+ """
315
+
316
+ # Mass
317
+ ax.plot(times, M1_out, color=primary_color)
318
+ ax.plot(times, M2_out, color=secondary_color)
319
+
320
+ for key, value in sys_obs.items():
321
+ if key == "M1":
322
+ ax.axhline(value, color=primary_color, linestyle="dashed")
323
+ if key == "M2":
324
+ ax.axhline(value, color=secondary_color, linestyle="dashed")
325
+
326
+ ax.set_ylabel(r"Mass ($M_{\odot}$)")
327
+ ax.set_xlim(np.min(times), np.max(times))
328
+
329
+
330
+ def plot_Teff(ax, times, Teff1_out, Teff2_out, sys_obs):
331
+ """Plots the stellar effectvie temperature as a function of time
332
+
333
+ Parameters
334
+ ----------
335
+ ax : `matplotlib.Axes`
336
+ Axis instance for the plot
337
+
338
+ times : `pandas.Series`
339
+ Series of times at each binary evolution time step in Myr
340
+
341
+ Teff1_out : `pandas.Series`
342
+ Series of primary effective temperature at each binary evolution time step in K
343
+
344
+ Teff2_out : `pandas.Series`
345
+ Series of secondary effective temperature at each binary evolution time step in K
346
+
347
+ sys_obs : `Dict`
348
+ Dictionary containing keys for binary parameters with values to plot
349
+ as vertical lines for each stellar component
350
+
351
+ Returns
352
+ -------
353
+ Null
354
+ """
355
+
356
+ # Effective temperature
357
+ ax.plot(times, Teff1_out, color=primary_color)
358
+ ax.plot(times, Teff2_out, color=secondary_color)
359
+
360
+ for key, value in sys_obs.items():
361
+ if key == "T1":
362
+ ax.axhline(value, color=primary_color, linestyle="dashed")
363
+ if key == "T2":
364
+ ax.axhline(value, color=secondary_color, linestyle="dashed")
365
+
366
+ ax.set_yscale("log")
367
+ ax.set_ylabel(r"T$_{\rm eff}$ (K)")
368
+ ax.set_xlim(np.min(times), np.max(times))
369
+ ax.set_xlabel("Time (Myr)")
370
+
371
+
372
+ def plot_Mdot(ax, times, Mdot1_out, Mdot2_out, legend=True):
373
+ """Plots the stellar effectvie temperature as a function of time
374
+
375
+ Parameters
376
+ ----------
377
+ ax : `matplotlib.Axes`
378
+ Axis instance for the plot
379
+
380
+ times : `pandas.Series`
381
+ Series of times at each binary evolution time step in Myr
382
+
383
+ Mdot1_out : `pandas.Series`
384
+ Series of primary mass transfer rate at each binary evolution time step in Msun/yr
385
+
386
+ Mdot2_out : `pandas.Series`
387
+ Series of secondary mass transfer rate at each binary evolution time step in Msun/yr
388
+
389
+ sys_obs : `Dict`
390
+ Dictionary containing keys for binary parameters with values to plot
391
+ as vertical lines for each stellar component
392
+
393
+ Returns
394
+ -------
395
+ Null
396
+ """
397
+
398
+ # Mass accretion rate
399
+ ax.plot(times, np.log10(np.clip(Mdot1_out, 1.0e-16, None)), color=primary_color)
400
+ ax.plot(times, np.log10(np.clip(Mdot2_out, 1.0e-16, None)), color=secondary_color)
401
+ ax.set_ylabel(r"Mass Accretion Rate ($M_{\odot}$ yr$^{-1}$)")
402
+
403
+ ax.set_ylim(-14, ax.get_ylim()[1])
404
+ ax.set_xlim(np.min(times), np.max(times))
405
+
406
+ if legend:
407
+ custom_lines = [
408
+ Line2D([0], [0], color="C0", linestyle="solid"),
409
+ Line2D([0], [0], color="C1", linestyle="solid"),
410
+ ]
411
+ ax.legend(custom_lines, ["Primary", "Secondary"], loc=2, frameon=False)
412
+
413
+
414
+ def plot_P_orb(ax, times, P_orb_out, t_max, sys_obs):
415
+ """Plots the orbital period as a function of time
416
+
417
+ Parameters
418
+ ----------
419
+ ax : `matplotlib.Axes`
420
+ Axis instance for the plot
421
+
422
+ times : `pandas.Series`
423
+ Series of times at each binary evolution time step in Myr
424
+
425
+ P_orb_out : `pandas.Series`
426
+ Series of orbital periods at each binary evolution time step in days
427
+
428
+ t_max : `float`
429
+ ending time for plot in Myr
430
+
431
+ sys_obs : `Dict`
432
+ Dictionary containing keys for binary parameters with values to plot
433
+ as vertical lines for each stellar component
434
+
435
+ Returns
436
+ -------
437
+ Null
438
+ """
439
+
440
+ ax.plot(times, P_orb_out, color="k")
441
+
442
+ for key, value in sys_obs.items():
443
+ if key == "P_orb":
444
+ ax.axhline(value, color="k", linestyle="dashed")
445
+
446
+ ax.set_xlim(np.min(times), t_max)
447
+
448
+ ax.set_ylabel(r"P$_{\rm orb}$ (days)")
449
+ ax.set_yscale("log")
450
+
451
+
452
+ def plot_ecc(ax, times, ecc_out, t_max, sys_obs):
453
+ """Plots the eccentricity as a function of time
454
+
455
+ Parameters
456
+ ----------
457
+ ax : `matplotlib.Axes`
458
+ Axis instance for the plot
459
+
460
+ times : `pandas.Series`
461
+ Series of times at each binary evolution time step in Myr
462
+
463
+ ecc_out : `pandas.Series`
464
+ Series of eccentricities at each binary evolution time step
465
+
466
+ t_max : `float`
467
+ ending time for plot in Myr
468
+
469
+ sys_obs : `Dict`
470
+ Dictionary containing keys for binary parameters with values to plot
471
+ as vertical lines for each stellar component
472
+
473
+ Returns
474
+ -------
475
+ Null
476
+ """
477
+
478
+ ax.plot(times, ecc_out, color="k")
479
+
480
+ for key, value in sys_obs.items():
481
+ if key == "ecc":
482
+ ax.axhline(value, color="k", linestyle="dashed")
483
+
484
+ ax.set_xlim(np.min(times), t_max)
485
+
486
+ ax.set_ylabel("Eccentricity")
487
+ ax.set_xlabel("Time (Myr)")
488
+
489
+
490
+ def plot_HR_diagram(ax, L1_out, L2_out, Teff1_out, Teff2_out):
491
+ """Plots the eccentricity as a function of time
492
+
493
+ Parameters
494
+ ----------
495
+ ax : `matplotlib.Axes`
496
+ Axis instance for the plot
497
+
498
+ times : `pandas.Series`
499
+ Series of times at each binary evolution time step in Myr
500
+
501
+ L1_out : `pandas.Series`
502
+ Series of primary luminosities at each binary evolution time step in Lsun
503
+
504
+ L2_out : `pandas.Series`
505
+ Series of secondary luminosities at each binary evolution time step in Lsun
506
+
507
+ Teff1_out : `pandas.Series`
508
+ Series of primary effective temperature at each binary evolution time step in K
509
+
510
+ Teff2_out : `pandas.Series`
511
+ Series of secondary effective temperature at each binary evolution time step in K
512
+
513
+ sys_obs : `Dict`
514
+ Dictionary containing keys for binary parameters with values to plot
515
+ as vertical lines for each stellar component
516
+
517
+ Returns
518
+ -------
519
+ Null
520
+ """
521
+
522
+ ax.plot(Teff1_out, L1_out, color=primary_color)
523
+ ax.plot(Teff2_out, L2_out, color=secondary_color)
524
+
525
+ ax.set_xscale("log")
526
+ ax.set_yscale("log")
527
+ ax.set_xlim(40000, 2000)
528
+
529
+ ax.set_xlabel(r"log T$_{\rm eff}$ (K)")
530
+ ax.set_ylabel("log L (erg/s)")
531
+
532
+ ax.set_xticks([2000, 5000, 10000, 20000, 40000])
533
+
534
+
535
+ def plot_binary_evol(bcm, sys_obs={}, ktype_kwargs={}, t_min=None, t_max=None):
536
+ """Plots the full set of plots and kstar bar plots
537
+
538
+ Parameters
539
+ ----------
540
+ bcm : `pandas.DataFrame`
541
+ binary evolution data form BSE's bcm dict
542
+
543
+ sys_obs : `Dict`
544
+ Dictionary containing keys for binary parameters with values to plot
545
+ as vertical lines for each stellar component
546
+
547
+ Returns
548
+ -------
549
+ fig : `matplotlib.figure`
550
+ Figure containing all the plots!
551
+ """
552
+
553
+ fig = plt.figure(figsize=(10, 10), layout="tight")
554
+
555
+ gs = fig.add_gridspec(2, 1, height_ratios=[1.3, 6], hspace=0.0)
556
+ gs_top = gs[0].subgridspec(2, 2, width_ratios=[1, 1], height_ratios=[1, 1.3], hspace=0.15)
557
+ gs_bottom = gs[1].subgridspec(3, 2, width_ratios=[1, 1], height_ratios=[2, 2, 2], hspace=0.15)
558
+
559
+ if t_min is not None:
560
+ bcm = bcm.loc[bcm.tphys >= t_min]
561
+ if t_max is not None:
562
+ bcm = bcm.loc[bcm.tphys <= t_max]
563
+
564
+ # k-type panels
565
+ plot_k_type(
566
+ fig.add_subplot(gs_top[0, 0]),
567
+ fig.add_subplot(gs_top[0, 1]),
568
+ fig.add_subplot(gs_top[1, :]),
569
+ bcm.tphys,
570
+ bcm.kstar_1.astype(int),
571
+ bcm.kstar_2.astype(int),
572
+ **ktype_kwargs
573
+ )
574
+
575
+ # Radius panel
576
+ plot_radius(
577
+ fig.add_subplot(gs_bottom[0, 0]),
578
+ bcm.tphys,
579
+ bcm.rad_1,
580
+ bcm.rad_2,
581
+ bcm.mass_1,
582
+ bcm.mass_2,
583
+ bcm.porb,
584
+ bcm.ecc,
585
+ sys_obs,
586
+ )
587
+
588
+ # Mass panel
589
+ plot_mass(fig.add_subplot(gs_bottom[1, 0]), bcm.tphys, bcm.mass_1, bcm.mass_2, sys_obs)
590
+
591
+ # Teff panel
592
+ plot_Teff(fig.add_subplot(gs_bottom[2, 0]), bcm.tphys, bcm.teff_1, bcm.teff_2, sys_obs)
593
+
594
+ # Mass accretion rate panel
595
+ plot_Mdot(fig.add_subplot(gs_bottom[0, 1]), bcm.tphys, bcm.deltam_1, bcm.deltam_2)
596
+
597
+ # Orbital period panel
598
+ plot_P_orb(
599
+ fig.add_subplot(gs_bottom[1, 1]),
600
+ bcm.loc[bcm.kstar_2 < 15].tphys,
601
+ bcm.loc[bcm.kstar_2 < 15].porb,
602
+ np.max(bcm.tphys),
603
+ sys_obs,
604
+ )
605
+
606
+ # Plot eccentricity panel
607
+ plot_ecc(
608
+ fig.add_subplot(gs_bottom[2, 1]),
609
+ bcm.loc[bcm.kstar_2 < 15].tphys,
610
+ bcm.loc[bcm.kstar_2 < 15].ecc,
611
+ np.max(bcm.tphys),
612
+ sys_obs,
613
+ )
614
+
615
+ # Plot HR diagram
616
+ # idx_1 = np.where(k1_out < 10)[0]
617
+ # idx_2 = np.where(k2_out < 10)[0]
618
+ # plot_HR_diagram(ax[7], L1_out[k1_out<10], L2_out[k2_out<10], Teff1_out[k1_out<10], Teff2_out[k2_out<10])
619
+
620
+ return fig
621
+
622
+
623
+ def evolve_and_plot(initC, t_min=None, t_max=None, BSEDict=None, sys_obs={}):
624
+ """
625
+ Evolve and plot binaries as a function of time
626
+
627
+ Parameters
628
+ ----------
629
+ initC : `pandas.DataFrame`
630
+ initial conditions for binary to evolve
631
+
632
+ t_min : `float or list`
633
+ starting time for plot in Myr
634
+
635
+ t_max : `float or list`
636
+ ending time for plot in Myr
637
+
638
+ BSEDict : `Dict`
639
+ Dictionary containing all BSE flags needed
640
+
641
+ sys_obs : `Dict`
642
+ Dictionary containing keys for binary parameters with values to plot
643
+ as vertical lines for each stellar component
644
+
645
+ Returns
646
+ -------
647
+ all_figs : `list`
648
+ list of all figures created
649
+ """
650
+
651
+ # Throw an error if user is plotting more than 10 binaries
652
+ if len(initC) > 10:
653
+ raise ValueError(
654
+ "You have asked to plot more than 10 separate binaries. This could cause problems..."
655
+ )
656
+
657
+ # Iterate over all binaries in initC
658
+ all_figs = []
659
+ for i in range(len(initC)):
660
+
661
+ # Check if t_min and t_max are lists
662
+ if isinstance(t_min, list):
663
+ t_min_tmp = t_min[i]
664
+ else:
665
+ t_min_tmp = t_min
666
+ if isinstance(t_max, list):
667
+ t_max_tmp = t_max[i]
668
+ else:
669
+ t_max_tmp = t_max
670
+
671
+ # Evolve binary
672
+ bcm = evolve_binary(
673
+ initC.iloc[i: i + 1], t_min=t_min_tmp, t_max=t_max_tmp, BSEDict=BSEDict
674
+ )
675
+
676
+ # Plot binary
677
+ fig = plot_binary_evol(bcm, sys_obs=sys_obs)
678
+
679
+ # Add to list of figs
680
+ all_figs.append(fig)
681
+
682
+ # Return list of figs
683
+ return all_figs
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # Copyright (C) Katie Breivik (2017 - 2020)
4
+ #
5
+ # This file is part of COSMIC
6
+ #
7
+ # COSMIC is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # COSMIC is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with COSMIC. If not, see <http://www.gnu.org/licenses/>
19
+
20
+ # load tables
21
+ from astropy.table import Column, Table
22
+ from .initialbinarytable import InitialBinaryTable
23
+ from .initialcmctable import InitialCMCTable
24
+
25
+ # attach unified I/O
26
+ from . import sampler