Skip to content

#7 Hdf5 writing added.#14

Merged
olaszsoma merged 3 commits into
developmentfrom
hdf5_writing_feature
Jan 13, 2020
Merged

#7 Hdf5 writing added.#14
olaszsoma merged 3 commits into
developmentfrom
hdf5_writing_feature

Conversation

@olaszsoma
Copy link
Copy Markdown
Member

The hdf5 writing feature is added to the NORSE actor. If an existing hdf5 file is used, the data is added to the datasets. The modification has been tested in Kepler.

@olaszsoma olaszsoma requested a review from gergopokol January 6, 2020 11:35
@olaszsoma olaszsoma self-assigned this Jan 6, 2020
Comment thread NORSE_actor/externalNORSERun.py Outdated
Comment on lines 28 to 33
# Define function to get variable name as string
def get_name(var):
import itertools
return [tpl[0] for tpl in
itertools.ifilter(lambda x: var is x[1], globals().items())][0]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This might be dangerous to identify an array based on its values (and size). For numpy arrays this might be a better solution: https://stackoverflow.com/questions/34980833/python-name-of-np-array-variable-as-string Should test and implement if ok.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

Comment thread NORSE_actor/externalNORSERun.py Outdated

growthRate = density[i]*eng.extractGrowthRate(o)
runawayDensity = density[i]*eng.extractFraction(o)
runawayCurrent = runawayDensity * 1.6e-19 * 3e8 * np.sign(E_parallel[i])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Constants should be defined in the object. Later these can be easily replaced by ITM constants.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

Comment thread NORSE_actor/externalNORSERun.py Outdated
runaway_current = np.array(runaway_current).reshape(1,rho_size)

# Write data to hdf5 file
hdf5Write.write(shot, run, temperature.reshape(1,rho_size), get_name(temperature), density, get_name(density), rhoTor, get_name(rhoTor), B0, get_name(B0), Z_eff, get_name(Z_eff), EHat, get_name(EHat), E_parallel, get_name(E_parallel), E_critical, get_name(E_critical), time, get_name(time), growth_rate, get_name(growth_rate), runaway_density, get_name(runaway_density), runaway_current, get_name(runaway_current)) No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

distribution and all important outputs should also be saved. The aim is to have a full set of outputs in HDF5.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should be done similarly as for the others, but for each rho coordinate there will be a vector (Bigvector in NORSE naming) of distribution and the coordinates instead of a single number like for the other parameters. I will have to find a way to do this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

Comment thread NORSE_actor/hdf5Write.py
# Written by Soma Olasz
#
# This function is created to write data to hdf5 file.

Copy link
Copy Markdown
Member

@gergopokol gergopokol Jan 6, 2020

Choose a reason for hiding this comment

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

Should explore the use of standard headers, like:

# -*- coding: utf-8 -*-
"""
Created on Mon Aug 12 11:45:34 2019

@author: Fehérvári Gergő
"""

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done for two scripts, the rest will be dealt with separately, when dealing with the relevant issue.

Comment thread NORSE_actor/hdf5Write.py Outdated
import pwd


def write(shotnumber, runnumber, *args):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would be safer from the point of view of data consistency to used a dictionary to pass data and respective names.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Copy Markdown
Member

@gergopokol gergopokol left a comment

Choose a reason for hiding this comment

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

Commented requests.

@olaszsoma olaszsoma mentioned this pull request Jan 7, 2020
Copy link
Copy Markdown
Member

@gergopokol gergopokol left a comment

Choose a reason for hiding this comment

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

Go ahead! :)

@olaszsoma olaszsoma merged commit 61bc8c3 into development Jan 13, 2020
@olaszsoma olaszsoma deleted the hdf5_writing_feature branch January 13, 2020 13:00
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