Skip to content

Conversation

@zhafen
Copy link

@zhafen zhafen commented Aug 1, 2022

Based on SpectrumGenerator. Happy to clean up as needed for it to be mergable.

Looks like my basic linetools code got mixed in too... Best to remove that.

Copy link
Collaborator

@chummels chummels left a comment

Choose a reason for hiding this comment

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

This is some cool functionality that you've written for Trident--thanks, Zach! I think it will be super great to use this with FIREFly. A few changes requested to get this in, but I don't think anything too onerous.

  1. Strip out the LineTools changes in the code, which I believe are unrelated to the content of this PR. We'll get the LineTools stuff addressed in that other PR soon.
  2. Add a little bit in the way of docstrings for your new class--again, this does not need to be too exhaustive, but just generally describing the function, args, and a bit of what is going on in the code.
  3. Similar to this, I was trying to think where in the narrative docs we can mention this, just so people will know that this cool functionality exists. Since this is one of the first instances of us integrating with another code, perhaps we just include an entry in the FAQ or something and just provide an example of how to use this code with FIREFly? Not sure where else we could put it, but I'm open to suggestions. Or maybe even adding a new page in the docs for "Visualizing Sightlines with the FIREFly Viz Tool" or something: https://trident.readthedocs.io/en/latest/ . Either way, it would be really nice to just show the user how to use this functionality on a dataset and how it looks in FIREFly.
  4. A basic unit test test_fire_fly_generator.pyin src/trident/tests that just tests to make sure the new functionality doesn't fail when called on a sample dataset.

Let me know if you need help with any of this, and I'll see what I can do. Thanks again for this awesome contribution!


class FireflyGenerator( object ):
"""
## OLD TEXT COMMENTED OUT ##
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove commented out docstrings for SpectrumGenerator and replace with description of FireFlyGenerator functionality and arguments.

assert ld.lines_all[0].identifier == HI.identifier
print(ld)

def test_line_database_add_line_linetools():
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this is leftover in your stack from previous changes you've made on LineTools. Is it possible to strip this out so we just focus on the Firefly functionality?

# If line_database is set, then use the underlying file as the line list
# to select ions from.
if line_database is not None:
line_database = LineDatabase(line_database)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this is leftover in your stack from previous changes you've made on LineTools. Is it possible to strip this out so we just focus on the Firefly functionality?


def add_line(self, element, ion_state, wavelength, gamma,
f_value, field=None, identifier=None):
def add_line(self, element, ion_state, wavelength, gamma=None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this is leftover in your stack from previous changes you've made on LineTools. Is it possible to strip this out so we just focus on the Firefly functionality?

# >>> sg.apply_lsf(function='boxcar', width=100)
# >>> sg.plot_spectrum('spec_final.png')
"""
def __init__(self, line_database='lines.txt',
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm guessing that this functionality will only work for particle-based datasets, right? If so, perhaps we need a conditional somewhere at the beginning of this code that checks to see if this is particle-based or grid-based and raises a "Not Implemented error" for grid-based datasets? Or something like that.

@zhafen
Copy link
Author

zhafen commented Aug 1, 2022 via email

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