Skip to content

Sonora brown dwarf model addition - #169

Closed
hustonm wants to merge 8 commits into
devfrom
sonora_mist_merger
Closed

hustonm wants to merge 8 commits into
devfrom
sonora_mist_merger

Conversation

@hustonm

@hustonm hustonm commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread spisea/evolution.py Outdated
np.log10(9.0e9),
np.log10(15.0e9),
])
age_list = np.array(sorted(set(regular_ages) | set(exact_ages)))

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the exact_ages thing doing?

Comment thread spisea/evolution.py Outdated
# The mass sampling varies with age, so there is no single exact list.
mass_list = []

if model_dir is None:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If models_dir is none, the code is not going to be able to find the models. We warn at the top of this code if that is the case that things won't work, so we don't have to have checks for it on each individual model

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took out the extra check for the models_dir. the "if model_dir is None" is for the optional directory argument. if there is none provided, then it uses the normal grid location. I'm happy to remove that as well though if you would prefer having this model always use the standard file location.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@riley get rid of it

Comment thread spisea/evolution.py Outdated
mass_list,
z_list,
)
self.model_version_name = (

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this make it a tuple? It needs to be a string

Comment thread spisea/evolution.py Outdated
'MergedFlameSkimmerRedDiamondbackMIST'
)
self.z_solar = 0.0142
self.metallicity_list = np.array(

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This already got defined above

Comment thread spisea/evolution.py Outdated
def __init__(self, model_dir=None):
self.z_solar = 0.0142
self.metallicity_list = np.array(
[-1.0, -0.75, -0.5, -0.25, 0.0, 0.25, 0.5], dtype=float

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you able to get the lower metallicity isochrones generated? I think they may be in the files but just not here

Comment thread spisea/evolution.py Outdated

@staticmethod
def _isochrone_filename(log_age):
if np.isclose(log_age, np.log10(9.0e9), rtol=0.0, atol=1.0e-8):

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these special cases for? I can see the one being the max age possible, though I don't think MIST goes that far. It's not clear what the other one is for

Comment thread spisea/evolution.py Outdated
return Table.read(full_iso_file, format='fits')

@staticmethod
def _standardize_proxy_component(frame, model_ref):

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think I see now why the metallicity values did not go to lower values before. I think a cleaner way to handle this would be to derive the merged atmospheres for low metallicity MIST and -1.0 BDs in advance and just have them in the pre-computed grids. This will allow for much faster loading of them in things like synthpop.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then they can just be handled the same way as the -1.0 metallicity and up

Comment thread spisea/atmospheres.py Outdated
ensure a smooth transition.
"""

if metallicity < -1.0 and temperature < 5000:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The phoenix models only go down to 2300 (I think that's the right number). We should include a check for logg, and if the object is a dwarf (within/near the logg range in sonora), we should just use the lowest metallicity Sonora model available. But, if the object is a giant (lower logg), then we'll need to go with phoenix.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, maybe this works by just making a logg check here instead of metallicity

Comment thread spisea/atmospheres.py
# gravity=gravity)


def get_merged_atmosphere_atlas_phoenix_sonora_grid(rebin=True):

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably need adjusted for the logg dependence when that's done

Comment thread spisea/atmospheres.py Outdated
sp = stsyn.grid_to_spec(atm_model_name, temperature, metallicity,
gravity)
except Exception as original_error:
# Do not use get_atmosphere_bounds() here: its generic fallback snaps

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a physical reason for this change?

Comment thread spisea/atmospheres.py Outdated

def _atmosphere_grid_supports_request(model_dir, metallicity, temperature,
gravity):
"""Return True only when a grid covers the request without clipping.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a lot of this stuff can probably be eliminated by putting the logg check in the get_merged_atmosphere... function for simplicity/speed

Comment thread spisea/tests/test_models.py Outdated
@@ -18,13 +17,21 @@ def test_evo_model_grid_num():

def test_evolution_models():
"""
Test to make sure the different evolution models work
Check each installed evolution model returns nonempty finite core fields

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I can't parse this comment. Can you clarify it or just put it back to what it was before?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed it back

Comment thread spisea/tests/test_models.py Outdated

# Array of metallicities for the specific evolution models to test
metal_vals = [metal_range, metal_solar, metal_solar, metal_solar, metal_solar, metal_solar, metal_solar, metal_Marley, metal_solar]
metal_vals = [metal_range, metal_solar, metal_solar, metal_solar, metal_solar, metal_solar, metal_solar, metal_Marley, metal_solar,
evo_models[-1].metallicity_list]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest not using the model object to keep this consistent with the others

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed accordingly

Comment thread spisea/tests/test_models.py Outdated
@@ -169,7 +184,15 @@ def test_COSMIC_get_kick_differential():

def test_atmosphere_models():
"""
Test the rebinned atmosphere models used for synthetic photometry
Check every installed atmosphere returns finite, nonnegative, nonzero

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This includes a weird amount of detail about your new model, not the others, which isn't a huge deal, but may be confusing for a reader later trying to understand whether it tests all models.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restored and refined, let me know if its still too much

Comment thread spisea/atmospheres.py

rebin: boolean
If true, rebins the atmospheres so that they are the same
resolution as the Castelli+04 atmospheres. Default is False,
resolution as the Castelli+04 atmospheres. Default is True,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this change or was it a documentation error before?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documentation error

Comment thread spisea/atmospheres.py Outdated

def get_merged_atmosphere_atlas_phoenix_sonora(metallicity=0, temperature=20000,
gravity=4.5, verbose=False, rebin=True):
"""Choose Flame, PHOENIX or ATLAS using temperature and log(g) in cgs.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super small thing, but we should say FlameSkimmer instead of Flame for clarity/consistency

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do

@hustonm hustonm closed this Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants