mors.stellarevo
stellarevo
Module for loading the stellar evolution tracks and retrieving basic stellar properties.
ModelDataDefault = None
module-attribute
evoModelsDefault = 'X0p70952_Z0p01631_A1p875'
module-attribute
log = logging.getLogger('fwl.' + __name__)
module-attribute
nDecValue = 7
module-attribute
StarEvo(starEvoDir=None, evoModels=evoModelsDefault)
Class to hold complete information about stellar evolution models.
An instance of this class will hold evolutionary tracks for all masses and all quantities of interest. For now, only models from Spada et al. (2013) can be loaded. The main set of information held in this class is in ModelData, which is a dictionary of dictionaries. Each dictionary in this dictionary corresponds to a single stellar mass and holds evolutionary tracks for a bunch of important quantities.
Attributes:
| Name | Type | Description |
|---|---|---|
ModelData |
dict
|
This is a dictionary of dictionaries, holding evolution tracks for each stellar mass. |
Source code in src/mors/stellarevo.py
60 61 62 63 64 65 66 67 68 69 70 71 72 | |
Icore(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns core moment of interia.
Source code in src/mors/stellarevo.py
147 148 149 | |
Ienv(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns envelope moment of interia.
Source code in src/mors/stellarevo.py
151 152 153 | |
Itotal(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns total moment of interia.
Source code in src/mors/stellarevo.py
143 144 145 | |
Lbol(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns bolometric luminosity.
Source code in src/mors/stellarevo.py
135 136 137 | |
LoadTrack(Mstar, ClearData=False)
Takes stellar mass, loads evolutionary track for a specific mass into the model data.
This can be useful if the user wants to load a specific evolutionary track into a model data for a specific mass since this will make getting values for this mass faster since no interpolation between mass bins will be needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Mstar
|
float
|
Mass of star in Msun. |
required |
ClearData
|
bool
|
If set to True, all other stellar masses will be removed from the ModelData dictionary. |
False
|
Returns:
| Type | Description |
|---|---|
None
|
None |
Source code in src/mors/stellarevo.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
Mcore(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns core mass.
Source code in src/mors/stellarevo.py
155 156 157 | |
Menv(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns envelope mass.
Source code in src/mors/stellarevo.py
159 160 161 | |
Rcore(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns core radius.
Source code in src/mors/stellarevo.py
163 164 165 | |
Rstar(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns stellar radius.
Source code in src/mors/stellarevo.py
131 132 133 | |
Teff(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns effective temperature.
Source code in src/mors/stellarevo.py
139 140 141 | |
Value(Mstar, Age, ParamString)
Takes stellar mass, age, and a parameter string, returns values corresponding to named parameter.
The set of models should have already been loaded. With this function, the user can ask for a value of one of the parameters for a specific stellar mass and age. All three of these can be input as multiple values and an array of values will be returned if this is the case. For example, if Mstar is input as a 1D array, the function will return a 1D array giving the value for each of these masses. ParamString can be input as a list of strings and values for each parameter in that list will be returned in a 1D array. If two are given as arrays or lists, then a 2D array will be returned. If all three then a 3D array with dimensions len(Mstar)xlen(Age)xlen(ParamString) will be returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Mstar
|
float or int or ndarray
|
Mass of star in Msun. |
required |
Age
|
float or int or ndarray
|
Age in Myr. |
required |
ParamString
|
str
|
String holding name of parameter to get value for. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
value |
float or ndarray
|
Value of parameter at this mass and age. |
Source code in src/mors/stellarevo.py
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 | |
dIcoredt(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns rate of change of core moment of inertia.
Source code in src/mors/stellarevo.py
175 176 177 | |
dIenvdt(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns rate of change of envelope moment of inertia.
Source code in src/mors/stellarevo.py
179 180 181 | |
dItotaldt(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns rate of change of total moment of inertia.
Source code in src/mors/stellarevo.py
171 172 173 | |
dMcoredt(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns rate of change of core mass.
Source code in src/mors/stellarevo.py
183 184 185 | |
dRcoredt(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns rate of change of core radius.
Source code in src/mors/stellarevo.py
187 188 189 | |
tauConv(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns convective turnover time.
Source code in src/mors/stellarevo.py
167 168 169 | |
Icore(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns core moment of interia.
Source code in src/mors/stellarevo.py
881 882 883 | |
Ienv(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns envelope moment of interia.
Source code in src/mors/stellarevo.py
885 886 887 | |
Itotal(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns total moment of interia.
Source code in src/mors/stellarevo.py
877 878 879 | |
Lbol(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns bolometric luminosity.
Source code in src/mors/stellarevo.py
869 870 871 | |
LoadTrack(Mstar, ModelData=None, ClearData=False)
Source code in src/mors/stellarevo.py
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 | |
Mcore(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns core mass.
Source code in src/mors/stellarevo.py
889 890 891 | |
Menv(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns envelope mass.
Source code in src/mors/stellarevo.py
893 894 895 | |
Rcore(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns core radius.
Source code in src/mors/stellarevo.py
897 898 899 | |
Rstar(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns stellar radius.
Source code in src/mors/stellarevo.py
865 866 867 | |
Teff(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns effective temperature.
Source code in src/mors/stellarevo.py
873 874 875 | |
Value(MstarIn, AgeIn, ParamString, ModelData=ModelDataDefault)
Takes stellar mass, age, and a parameter string, returns values corresponding to named parameter.
The set of models should have already been loaded. With this function, the user can ask for a value of one of the parameters for a specific stellar mass and age. All three of these can be input as multiple values and an array of values will be returned if this is the case. For example, if MstarIn is input as a 1D array, the function will return a 1D array giving the value for each of these masses. ParamString can be input as a list of strings and values for each parameter in that list will be returned in a 1D array. If two are given as arrays or lists, then a 2D array will be returned. If all three then a 3D array with dimensions len(MstarIn)xlen(AgeIn)xlen(ParamString) will be returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
MstarIn
|
float or int or ndarray
|
Mass of star in Msun. |
required |
AgeIn
|
float or int or ndarray
|
Age in Myr. |
required |
ParamString
|
str
|
String holding name of parameter to get value for. |
required |
ModelData
|
dict
|
Dictionary of dictionaries holding set of stellar evolution models. |
ModelDataDefault
|
Returns:
| Name | Type | Description |
|---|---|---|
value |
float or ndarray
|
Value of parameter at this mass and age. |
Source code in src/mors/stellarevo.py
640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | |
_CalculateGradient(Age, X)
Takes an evolutionary track for quantity, returns evolution of rate of change of quantity.
Source code in src/mors/stellarevo.py
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | |
_CheckAgeLimit(AgeArray, Age)
Takes age track and an age, outputs error and stops code if age is not within limits.
Source code in src/mors/stellarevo.py
805 806 807 808 809 810 811 812 813 814 815 | |
_CheckMassLimit(MstarArray, Mstar)
Takes array of masses and an age, outputs error and stops code if mass is not within limits.
Source code in src/mors/stellarevo.py
817 818 819 820 821 822 823 | |
_CompileNewGrid(starEvoDir, evoModels)
Compiles new dictionary of stellar evo models.
Source code in src/mors/stellarevo.py
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 | |
_Interpolate1D(Xarray, Yarray, X)
Takes 1D arrays for corresponding X and Y values, returns interpolated Y value corresponding to input X.
Source code in src/mors/stellarevo.py
838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 | |
_Interpolate2D(Z1, Z2, Z, Xarray1, Xarray2, X, Yarray1, Yarray2)
Takes two sets of 1D arrays for corresponding X and Y values, returns interpolated Y value corresponding to input X.
Source code in src/mors/stellarevo.py
825 826 827 828 829 830 831 832 833 834 835 836 | |
_LoadDefaultModelData()
Source code in src/mors/stellarevo.py
628 629 630 631 632 633 634 635 636 637 638 | |
_LoadModels(starEvoDir=None, evoModels=evoModelsDefault)
Loads evolutionary tracks as a grid of parameters at each mass and age.
Source code in src/mors/stellarevo.py
191 192 193 194 195 196 197 198 199 200 201 202 203 | |
_LoadSavedGrid(starEvoDir, evoModels)
Takes filename for stellar evo model, returns grid of models.
Source code in src/mors/stellarevo.py
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | |
_LoadTrack(Mstar, ModelData)
Takes stellar mass and model data dictionary, returns dictionary with track for this mass.
Source code in src/mors/stellarevo.py
570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 | |
_ReadEvolutionTrack(starEvoDir, evoModels, Mstar, MstarFilenameMiddle)
Loads the stellar evolution models from Spada et al. (2013) for a mass bin and puts it into a dictionary.
Source code in src/mors/stellarevo.py
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 | |
_RemoveDuplicateAges(nHeader, content)
Takes lines from evo file, removes duplicate ages.
Source code in src/mors/stellarevo.py
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 | |
_ValueSingle(Mstar, Age, ParamString, ModelData=ModelDataDefault)
Takes stellar mass and age and parameter string, returns value of that parameter at that mass and age.
Source code in src/mors/stellarevo.py
752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 | |
__getattr__(name)
Resolve starEvoDirDefault on access, so importing fetches nothing.
Source code in src/mors/stellarevo.py
28 29 30 31 32 | |
_defaultStarEvoDir()
Return the directory of the Spada evolution models as a string.
Source code in src/mors/stellarevo.py
23 24 25 | |
_gridCacheFile(starEvoDir, evoModels)
Return the path of the compiled-grid cache file for a track directory.
The cache lives in the user cache directory, never inside the track directory itself, which is immutable fetched data and may be read-only. The key covers the resolved directory path and a fingerprint of its contents, so a symlink and its target share one entry, and a directory whose files change never serves a grid compiled from the old data.
Source code in src/mors/stellarevo.py
224 225 226 227 228 229 230 231 232 233 234 235 236 | |
_shouldCompileNew(starEvoDir, evoModels)
Takes directory for stellar evo models, returns if new grid needs to be compiled.
Source code in src/mors/stellarevo.py
238 239 240 241 242 243 244 245 246 247 248 | |
_starEvoDirFingerprint(starEvoDir)
Digest the names, sizes and modification times of the files under a track directory.
Source code in src/mors/stellarevo.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |
dIcoredt(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns rate of change of core moment of inertia.
Source code in src/mors/stellarevo.py
909 910 911 | |
dIenvdt(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns rate of change of envelope moment of inertia.
Source code in src/mors/stellarevo.py
913 914 915 | |
dItotaldt(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns rate of change of total moment of inertia.
Source code in src/mors/stellarevo.py
905 906 907 | |
dMcoredt(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns rate of change of core mass.
Source code in src/mors/stellarevo.py
917 918 919 | |
dRcoredt(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns rate of change of core radius.
Source code in src/mors/stellarevo.py
921 922 923 | |
spada_data_dir()
Return the directory that holds the Spada model grid.
This is the fs255_grid directory inside the versioned fwl-io location of
the Spada archive. Resolving the path does not download the tracks; call
DownloadEvolutionTracks("Spada") (or mors download spada) to populate it.
Source code in src/mors/data.py
116 117 118 119 120 121 122 123 | |
tauConv(Mstar, Age, ModelData=ModelDataDefault)
Takes mass and age, returns convective turnover time.
Source code in src/mors/stellarevo.py
901 902 903 | |