Hi Edward.
Thank you for your suggestion.
I will keep this possibility in mind. :-)
I think I aim at exporting to a flat text files.
Here the value.write function actually fulfil my needs.
The loading and saving of state files is to slow for me, and I prefer to also be able to inspect text files quickly. :-)
This seems to be a good way to handle the value.write files:
-----------------
# Importing this to prepare for python 3.x
#from __future__ import print_function
# Import other
import os, re
import itertools
import numpy as np
import matplotlib.pyplot as plt
# Loop through methods.
METHODS = ['XXX']
for METHOD in METHODS:
# Open pipe names file
pipes_r2eff_filename = 'pipes_r2eff_%s.txt'%(METHOD)
pipes_r2eff_file = open(pipes_r2eff_filename,'r')
pipes_r2eff_filelines = pipes_r2eff_file.readlines()
pipes_r2eff_file.close()
# Extract pipe names
setup_pipe_bundle = "%s"%pipes_r2eff_filelines[0].strip()
state_save_name = "%s.bz2"%pipes_r2eff_filelines[1].strip()
# Extract which to compare to
compare_ni_pipe_name_r2eff = pipes_r2eff_filelines[2].strip()
# Get index of file
with open(os.path.join('r2eff', compare_ni_pipe_name_r2eff), 'r') as f:
for line in f:
if line.startswith('# mol_name'):
fileindex = line.split()[1:]
# Remove not allowed letters
fileindex = [w.replace('(', '') for w in fileindex]
fileindex = [w.replace(')', '') for w in fileindex]
fileindex = [w.replace('.', '') for w in fileindex]
# Prepare to define what file exist of
fdtype="S20,i,S3,i,S5"
for item in fileindex[5:]:
fdtype += ",f8"
print fdtype
data = "" compare_ni_pipe_name_r2eff), dtype=fdtype, names=fileindex)
print(data.dtype)
print(data.dtype.names)
print data['%s'%fileindex[0]]
print data['%s'%fileindex[6]]