Commit 0c75436e8d86b6924edcf4897348dbbefa61faa7

Authored by hitier
1 parent ea48da74
Exists in rhitier-dev

Better check in vtot calculation

Showing 1 changed file with 4 additions and 2 deletions   Show diff stats
@@ -939,8 +939,10 @@ def generate_csv_contents_spz(target_slug, input_slug, started_at, stopped_at): @@ -939,8 +939,10 @@ def generate_csv_contents_spz(target_slug, input_slug, started_at, stopped_at):
939 939
940 from math import sqrt 940 from math import sqrt
941 final_df = pd.concat(list_df, axis=1) 941 final_df = pd.concat(list_df, axis=1)
942 - # Is ther a vtot param ? else build it  
943 - if 'vtot' not in final_df.columns: 942 + # build vtot param if doesnt exist
  943 + if 'vtot' not in final_df.columns \
  944 + and 'vtan' in final_df.columns \
  945 + and 'vrad' in final_df.columns:
944 final_df['vtot'] = final_df.apply(lambda x: sqrt(x.vtan * x.vtan + x.vrad * x.vrad), axis=1) 946 final_df['vtot'] = final_df.apply(lambda x: sqrt(x.vtan * x.vtan + x.vrad * x.vrad), axis=1)
945 947
946 cols_ordered = ['vrad', 'vtan', 'vtot', 'btan', 'brad', 'temp', 'pdyn', 'dens', 'atse', 'xhee', 'yhee'] 948 cols_ordered = ['vrad', 'vtan', 'vtot', 'btan', 'brad', 'temp', 'pdyn', 'dens', 'atse', 'xhee', 'yhee']