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

Fix for PR #801 #802

Merged
merged 1 commit into from
Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions tardis/plasma/properties/ion_population.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,20 +349,4 @@ def calculate(self, phi, partition_function, number_density,
1].sum(axis=0))
ion_number_density.ix[2].ix[2].update(helium_population_updated.ix[
2].ix[0])
ion_numbers = ion_number_density.index.get_level_values(1).values
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this code block is not required when electron_densities are read from a seperate file in IonNumberDensityHeNLTE class.

Copy link
Member

Choose a reason for hiding this comment

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

@vg3095 well often it isn't - we need to be careful here. It needs to calculate them if they are not given. They will often not be given.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wkerzendorf
See this line, and here, I have removed this code block from second link (from else part --> if electron_densities is present).

ion_numbers = ion_numbers.reshape((ion_numbers.shape[0], 1))
new_n_electron = (ion_number_density.values * ion_numbers).sum(
axis=0)
if np.any(np.isnan(new_n_electron)):
raise PlasmaIonizationError('n_electron just turned "nan" -'
' aborting')
n_electron_iterations += 1
if n_electron_iterations > 100:
logger.warn('n_electron iterations above 100 ({0}) -'
' something is probably wrong'.format(
n_electron_iterations))
if np.all(np.abs(new_n_electron - n_electron)
/ n_electron < n_e_convergence_threshold):
break
n_electron = 0.5 * (new_n_electron + n_electron)
return ion_number_density, n_electron, helium_population_updated
3 changes: 2 additions & 1 deletion tardis/plasma/standard_plasmas.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
JBluesDetailed,
RadiationFieldCorrection,
StimulatedEmissionFactor,
HeliumNumericalNLTE)
HeliumNumericalNLTE,
IonNumberDensity)

logger = logging.getLogger(__name__)

Expand Down