Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot disable convergence plots #2917

Open
2 tasks
atharva-2001 opened this issue Dec 30, 2024 · 3 comments · May be fixed by #2926
Open
2 tasks

Cannot disable convergence plots #2917

atharva-2001 opened this issue Dec 30, 2024 · 3 comments · May be fixed by #2926

Comments

@atharva-2001
Copy link
Member

Describe the bug

Cannot disable convergence plots in Standard Workflows notebook

UnboundLocalError                         Traceback (most recent call last)
Cell In[4], line 1
----> 1 workflow.run()

File ~/tardis-main/tardis/tardis/workflows/standard_tardis_workflow.py:231, in StandardTARDISWorkflow.run(self)
    222 opacity_states = self.solve_opacity()
    224 transport_state, virtual_packet_energies = self.solve_montecarlo(
    225     opacity_states, self.real_packet_count
    226 )
    228 (
    229     estimated_values,
    230     estimated_radfield_properties,
--> 231 ) = self.get_convergence_estimates(transport_state)
    233 if self.convergence_plots is not None:
    234     self.convergence_plots.update()

File ~/tardis-main/tardis/tardis/workflows/standard_tardis_workflow.py:169, in StandardTARDISWorkflow.get_convergence_estimates(self, transport_state)
    159 if self.convergence_plots is not None:
    160     plot_data = {
    161         "t_inner": [self.simulation_state.t_inner.value, "value"],
    162         "t_rad": [self.simulation_state.t_radiative, "iterable"],
   (...)
    167         "Requested": [self.luminosity_requested.value, "value"],
    168     }
--> 169 self.update_convergence_plot_data(plot_data)
    171 logger.info(
    172     f"\n\tLuminosity emitted   = {emitted_luminosity:.3e}\n"
    173     f"\tLuminosity absorbed  = {absorbed_luminosity:.3e}\n"
    174     f"\tLuminosity requested = {self.luminosity_requested:.3e}\n"
    175 )
    177 self.log_plasma_state(
    178     self.simulation_state.t_radiative,
    179     self.simulation_state.dilution_factor,
   (...)
    183     estimated_t_inner,
    184 )

UnboundLocalError: cannot access local variable 'plot_data' where it is not associated with a value

To Reproduce

Screenshots

System

  • OS:

    • GNU/Linux
    • macOS
  • Environment (conda list):

Additional context

@karthik11135
Copy link

We can only update the convergence plots when we have plot_data. So the function has to be called inside the if statement. (line 169)

@atharva-2001
Copy link
Member Author

atharva-2001 commented Dec 31, 2024

I don't think so. It just needs a tab to move the plot data statement in the if statement. I will fix this issue on another pull request. Opening a pull request just to solve this issue wouldn't be nice.

@karthik11135
Copy link

Yeah exactly. That's what I was trying to say. self.update_convergence_plot_data(plot_data) needs to be inside the if statement so that it can access plot_data.

@karthik11135 karthik11135 linked a pull request Jan 6, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants