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

Bugfix radiative rates type detailed #486

Merged

Conversation

chvogl
Copy link
Contributor

@chvogl chvogl commented Feb 12, 2016

In the current version of TARDIS the detailed mode for the estimation of radiative rates does not work (see #487). This PR fixes the problem.

@wkerzendorf
Copy link
Member

I guess these things are only slow-testable. So merge now and do a test later - what do people think @tardis-sn/tardis-core

@unoebauer
Copy link
Contributor

If we want to properly test it, we need a slow test. However, one could think about simple, quick test, which just runs Tardis with few packets in the detailed mode and checks that it doesn't break and that j_blues are returned.

@chvogl, @wkerzendorf - thoughts on this?

@unoebauer unoebauer added this to the v1.5 milestone Feb 15, 2016
unoebauer and others added 2 commits February 15, 2016 14:38
* modified tardis full test to check also for j_blue_estimator
* added data file containing reference data for j_blue_estimator
Add simple test for j_blue_estimator
@unoebauer
Copy link
Contributor

@wkerzendorf - with the last commit, we have introduced a simple test to check the j_blue_estimators. Naturally, the slow test should probe the detailed mode thoroughly.

Still, a simple test is in place and I'd merge it - objections, @wkerzendorf, @orbitfold?

@wkerzendorf
Copy link
Member

@unoebauer - signing off on this!

@@ -207,7 +207,7 @@ def calculate_j_blues(self, init_detailed_j_blues=False):
logger.info('Calculating J_blues for radiate_rates_type=detailed')

self.j_blues = pd.DataFrame(
self.j_blue_estimators.transpose() *
self.j_blue_estimators *
self.j_blues_norm_factor.value,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like the way this is indented, the bottom line in the multiplication should be indented one level to the right.

Copy link
Member

Choose a reason for hiding this comment

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

Is this a specific PEP8 violation?

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't know but it should be. Now it looks like it is another argument at first glance and not a part of an expression.

Copy link
Member

Choose a reason for hiding this comment

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

You are the style person - can you suggest how to make it PEP8 conform?

Copy link
Contributor

Choose a reason for hiding this comment

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

There are people that fancy the operator on the next line for that reason.
(Which is against PEP)

The pythonic way might be to save the calculation in a temporary variable
and pass that as the argument.

Wolfgang Kerzendorf notifications@github.com schrieb am Di., 16. Feb.
2016 17:11:

In tardis/model.py
#486 (comment):

@@ -207,7 +207,7 @@ def calculate_j_blues(self, init_detailed_j_blues=False):
logger.info('Calculating J_blues for radiate_rates_type=detailed')

         self.j_blues = pd.DataFrame(
  •            self.j_blue_estimators.transpose() *
    
  •            self.j_blue_estimators *
             self.j_blues_norm_factor.value,
    

You are the style person - can you suggest how to make it PEP8 conform?


Reply to this email directly or view it on GitHub
https://github.com/tardis-sn/tardis/pull/486/files#r53032635.

Copy link
Contributor

Choose a reason for hiding this comment

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

PEP8 does not address everything. And in a lot of cases it is not entirely clear what is meant. For example it says to use blank lines inside method bodies "sparingly, to indicate logical sections". What does that mean? I think 80% of TARDIS's Python code is in violation of that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok - it seems as if this innocent little line of code is sparking a fundamental discussion of TARDIS coding style. I'd suggest we address this properly either in a TEP or on the tardis documentation (after first agreeing on a style, naturally) and just get on with the fix at hand.

Pragmatic solution - just leave it as it is until we have decided on conventions for cases which are not unambiguously covered by PEP8 and merge the PR

Copy link
Contributor

Choose a reason for hiding this comment

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

After getting informed more about coding styles I have to admit indenting the next line would look better and improve readability.

We should definitely write some code guidelines for the documentation and every time we encounter something not handled yet add it.

Copy link
Member

Choose a reason for hiding this comment

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

@yeganer can you do a PR on @chvogl's PR and implement that then.

Copy link
Contributor

Choose a reason for hiding this comment

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

Guys - let's not get sidetracked here - we want to fix the detailed mode! Let's merge and not get bugged down in style questions (which we also have not yet been formalised!)

@unoebauer
Copy link
Contributor

Happy with it @chvogl?

@wkerzendorf
Copy link
Member

Okay @yeganer @orbitfold - we will merge this PR tomorrow at 2pm. If you want to change the current style, make a PR to this PR by then.

wkerzendorf added a commit that referenced this pull request Feb 18, 2016
@wkerzendorf wkerzendorf merged commit e687eea into tardis-sn:master Feb 18, 2016
sooryan pushed a commit to sooryan/tardis that referenced this pull request Feb 22, 2016
…ype-detailed

Bugfix radiative rates type detailed
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.

5 participants