# Path: src/ct/def_ct_tools.py
# def load_raw(path_raw):
#     raw_file = np.load(open(path_raw, 'rb'))
#     raw = dict()
#     for key in raw_file.keys():
#         if key in ['mole_fraction','net_reaction_rate']:
#             raw[key] = np.matrix(raw_file[key])
#         else:
#             raw[key] = raw_file[key]
#     return raw


import os, json
import numpy as np
from src.ct.def_ct_tools import load_raw
from networkx.readwrite import json_graph
from scipy.stats.mstats import gmean
	for v in GPSA[method0]:
		if v is None:
			data.append(0)
		else:
			data.append(v)

	if 'production' in method:
		return [max(0,v) for v in data]
	elif 'consumption' in method:
		return [max(0,-v) for v in data]
	else:
		return data




def	find_GPSA(dir_raw, GP_dict, soln, dnR, fuel_comp, n_break=0):

	GP_name = GP_dict['name']
	traced = GP_dict['traced']
	dir_save = os.path.join(dir_raw,'GPSA',traced)
	if not os.path.exists(dir_save):
		os.makedirs(dir_save)
	path_save = os.path.join(dir_save, shorten_GP_name(GP_name)+'.json')
	print('[GPSA] to be saved: '+str(path_save))
	
	# =====================================
	# if previously computed, return False

	GPSA_all = dict()

# Path: src/ct/def_ct_tools.py
# def load_raw(path_raw):
#     raw_file = np.load(open(path_raw, 'rb'))
#     raw = dict()
#     for key in raw_file.keys():
#         if key in ['mole_fraction','net_reaction_rate']:
#             raw[key] = np.matrix(raw_file[key])
#         else:
#             raw[key] = raw_file[key]
#     return raw


# Path: src/core/def_GPSA.py
import os, json
import numpy as np
from src.ct.def_ct_tools import load_raw
from networkx.readwrite import json_graph
from scipy.stats.mstats import gmean

	for v in GPSA[method0]:
		if v is None:
			data.append(0)
		else:
			data.append(v)

	if 'production' in method:
		return [max(0,v) for v in data]
	elif 'consumption' in method:
		return [max(0,-v) for v in data]
	else:
		return data




def	find_GPSA(dir_raw, GP_dict, soln, dnR, fuel_comp, n_break=0):

	GP_name = GP_dict['name']
	traced = GP_dict['traced']
	dir_save = os.path.join(dir_raw,'GPSA',traced)
	if not os.path.exists(dir_save):
		os.makedirs(dir_save)
	path_save = os.path.join(dir_save, shorten_GP_name(GP_name)+'.json')
	print('[GPSA] to be saved: '+str(path_save))
	
	# =====================================
	# if previously computed, return False

	GPSA_all = dict()

	if os.path.exists(path_save):