Skip to content

Instantly share code, notes, and snippets.

@pukpr
Last active December 13, 2023 13:48
Show Gist options
  • Save pukpr/c7ab804de3621a6f5f96be1152cf2d24 to your computer and use it in GitHub Desktop.
Save pukpr/c7ab804de3621a6f5f96be1152cf2d24 to your computer and use it in GitHub Desktop.
# The command you want to execute
$command = " .\eexp.exe 0.8"
# The name of the output file generated by the command
$generatedFileName = "lte_results.csv"
$generatedDataName = "dlod_compare.csv"
# The base name for the renamed output files
$baseFileName = "lte_results"
$baseDataName = "dlod_compare"
# Starting index for file numbering
$index = 1
# Define how many times to repeat the execution
$repeatCount = 15 # Change this to the desired count
for ($i = 0; $i -lt $repeatCount; $i++) {
# Execute the command
Invoke-Expression $command
# Wait for the file to be created if necessary
# while (-not (Test-Path $generatedFileName)) {
# Start-Sleep -Milliseconds 100
# }
# Construct the new file name
$newFileName = $baseFileName + $index + ".csv"
$newDataName = $baseDataName + $index + ".csv"
# Rename or move the output file
Move-Item $generatedFileName $newFileName
Move-Item $generatedDataName $newDataName
# Increment the file index for the next iteration
$index++
}
# End of script
import pandas as pd
import numpy as np
import sys
def ensemble_average(prefix, file_count):
# Initialize an empty DataFrame for the sum
sum_df = None
count = 0
# Loop through each file and add to the sum
for i in range(1, file_count + 1):
filename = f"{prefix}{i}.csv"
try:
df = pd.read_csv(filename, header=None)
if sum_df is None:
sum_df = df
else:
sum_df += df
count += 1
except FileNotFoundError:
print(f"File not found: {filename}")
continue
# Calculate the average
avg_df = sum_df / count
# Save the ensemble average to a new CSV file
avg_df.to_csv(f"{prefix}.csv", header=False, index=False)
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: python ensemble_average.py [prefix] [file_count]")
sys.exit(1)
prefix = sys.argv[1]
file_count = int(sys.argv[2])
ensemble_average(prefix, file_count)
@pukpr
Copy link
Author

pukpr commented Dec 13, 2023

image

Status: 4 2 0.73618 0.41347 # 591

  -0.00003812396 :offset:
   0.00091331058 :bg:
  -4.99237183474 :impA:
   0.34131049274 :impB:
  -0.69943933031 :impC:
  -6.17633166860:delA:
   0.00388584392:delB:
   0.02537245974:asym:
  -0.03333431901:ann1:
   0.12544259922:ann2:
Status:  4 2   0.73618   0.41347 # 592
   0.01024028074:sem1:
   0.00000000000:sem2:
   0.00054011987:year:
  -0.50894561313:IR:
   0.00203622302 :mA:
  -0.01312602019 :mP:
   0.07100853168 :shiftT:
  -0.07168321635 :init:
---- Tidal ----
   9.10846048884,    0.00277569143,    0.23936177780,  1, -1,  2.79078891759824E-03
  29.53062765290,    0.00184860441,   -1.06866467918,  2, -1,  1.86709722566578E-03
  27.09267692660,    0.00489034517,   -1.29580713299,  3,  0,  4.88550841583621E-03
   7.08840376230,    0.00596117928,    1.37830264286,  4,  0,  5.93399658146010E-03
   6.85248390316,    0.00402899762,    2.07132336178,  5,  0,  4.02682091286523E-03
  13.60611040750,    0.00997640182,   -1.07149680034,  6,  0,  9.96121375505186E-03
  13.66083077700,    0.31595206465,   -2.63110932094,  7,  0,  3.15952064653504E-01
3396.73824406533,    0.00088204920,   -1.12328878099,  8,  0,  8.81943701789049E-04
   9.12068919638,    0.03497160585,   -0.02489689458,  9,  0,  3.49752886714045E-02
  13.77727494300,    0.01335519083,    0.43223171150,  10,  0,  1.33696694790510E-02
6793.47648813065,    0.00117040343,    1.94635429487,  11,  0,  1.17021955188122E-03
  27.55454988600,    0.08568536777,   -1.32993786631,  12,  0,  8.56852729184810E-02
  27.66676714572,    0.00732233273,    0.73576748645,  13,  0,  7.31756328717857E-03
  27.44323926226,    0.00448562104,    2.58163148895,  14,  0,  4.48560327952359E-03
1616.30271425126,    0.00015844347,   -2.67441524903,  15, -2,  1.61380222276656E-04
   6.85940288609,    0.01486957768,    1.00503106558,  16,  0,  1.48719845209269E-02
   7.09580762239,    0.01708176412,    0.66929548677,  17,  0,  1.70992173274256E-02
   9.55688197219,    0.01541734699,   -1.10968850761,  18,  0,  1.54173605063359E-02
   9.13295078376,    0.08563027309,   -0.82849408359,  19,  0,  8.56302730851973E-02
2190.35004466729,    0.00057759180,   -2.10897864550,  20, -1,  5.81984672471976E-04
  27.21222081500,    0.00145488625,    1.99744339753,  21,  0,  1.46133901478102E-03
   9.18484996200,    0.00230955949,    2.40424735927,  22,  0,  2.30783747665313E-03
  14.76531382645,    0.02523811569,    0.15598046700,  23,  0,  2.52235673845922E-02
  31.81203118928,    0.01539728500,   -1.59068928890,  24,  0,  1.54179615070802E-02
   9.54345649152,    0.00637042890,    0.09889736941,  25,  0,  6.36688925795869E-03
  13.63341568476,    0.12813417987,   -1.84762544072,  26,  0,  1.28149176538761E-01
  26.98505934729,    0.00314021691,   -0.68085818073,  27,  0,  3.14021411295958E-03
   5.64270614135,    0.00458616646,    2.48905397685,  28,  0,  4.58616646269133E-03
6167.20701373239,    0.00046972720,   -0.06193018327,  29,  0,  4.69996021487511E-04
 121.75014283996,    0.00378107029,    2.33701395923,  30,  0,  3.78110593679657E-03
   9.61372605493,    0.00680979178,    2.24351539378,  31,  0,  6.80991990027044E-03
3232.60542850251,    0.00095477658,    2.94739434943,  32,  0,  9.55220945211275E-04
---- LTE ----
   0.00000000000 :trend:
   0.00000000000 :accel:
-8172.66112771797 :K0:
55021.09402847719 :level:
   1.50072242769,    0.06355267391,   -1.14516242460 0
  -1.59877423441,    0.05195724674,    0.22146276764 0
  -1.08995480438,    0.04051742372,   -0.33210873258 0
   0.21225392225,    1.98180962648,    2.51862835052 0
   0.21411207850,    1.97803197165,   -0.70915430319 0
  -3.25549859324,    0.02209913918,   -0.55640043676 0
   2.25316448639,    0.06223478664,    1.43795333181 0
  -0.61993821507,    0.03423752712,   -2.90429696213 0
   0.52003467373,    0.03306734399,    1.56878532735 0
   0.00019359068, 6718965.64459591825,   -0.00818898838 0
 -76.18455444988,    0.01160806179,    2.83433216536 1
-609.47643559907,    0.07496960785,   -1.24781570248 8

CC 0.4134731916 0.7361752774 4 1
0.99999997629:dLOD:
PS C:\Users\pp\github\pukpr\GeoEnergyMath\qbo> ..\io\backup amo-abs-pt413pt736pt999999976

image

Status: 1 2 0.77076 0.35996 # 1808

  -0.00003814235 :offset:
   0.00091331031 :bg:
  -4.76801920792 :impA:
   0.34937692155 :impB:
  -0.55876413923 :impC:
  -6.17633179123:delA:
   0.00388584392:delB:
   0.02537549924:asym:
  -0.02735685536:ann1:
   0.00204020507:ann2:
   0.00858819635:sem1:
   0.00000000000:sem2:
   0.00054011754:year:
  -0.49035282245:IR:
   0.00204765089 :mA:
  -0.01312600769 :mP:
   0.07100853168 :shiftT:
  -0.07250206783 :init:
---- Tidal ----
   9.10846048884,    0.00277546977,    0.24124285834,  1, -1,  2.79078891759824E-03
  29.53062765292,    0.00183998149,   -1.07856056853,  2, -1,  1.86709722566578E-03
  27.09267692660,    0.00487614097,   -1.29595854110,  3,  0,  4.88550841583621E-03
   7.08840376231,    0.00596422046,    1.37830264286,  4,  1,  5.93399658146010E-03
   6.85248390316,    0.00403898401,    2.07157899828,  5,  0,  4.02682091286523E-03
  13.60611040750,    0.00998922796,   -1.07149147702,  6,  0,  9.96121375505186E-03
  13.66083077700,    0.31595152110,   -2.63110059895,  7,  0,  3.15952064653504E-01
3396.73824406533,    0.00088236420,   -1.12243950254,  8,  0,  8.81943701789049E-04
   9.12068919638,    0.03496983160,   -0.02492558439,  9,  0,  3.49752886714045E-02
  13.77727494300,    0.01335667585,    0.43137570298,  10,  0,  1.33696694790510E-02
6793.47648813065,    0.00117040343,    1.94631916747,  11,  0,  1.17021955188122E-03
  27.55454988600,    0.08569672894,   -1.32993786631,  12,  0,  8.56852729184810E-02
  27.66676714572,    0.00732189445,    0.73547363973,  13,  0,  7.31756328717857E-03
  27.44323926226,    0.00448215123,    2.57890212882,  14,  0,  4.48560327952359E-03
1616.30271425126,    0.00013975384,   -2.69278584894,  15, -13,  1.61380222276656E-04
   6.85940288609,    0.01486679401,    1.00516271231,  16,  0,  1.48719845209269E-02
   7.09580762240,    0.01705331234,    0.66924897343,  17,  0,  1.70992173274256E-02
   9.55688197219,    0.01541750661,   -1.10926871987,  18,  0,  1.54173605063359E-02
   9.13295078376,    0.08563020071,   -0.82849118458,  19,  0,  8.56302730851973E-02
2190.35004466729,    0.00057759180,   -2.10653393802,  20, -1,  5.81984672471976E-04
  27.21222081500,    0.00143845894,    1.99974085416,  21, -2,  1.46133901478102E-03
   9.18484996200,    0.00230698581,    2.39837023811,  22,  0,  2.30783747665313E-03
  14.76531382646,    0.02523811188,    0.15598023136,  23,  0,  2.52235673845922E-02
  31.81203118931,    0.01539693878,   -1.59086682481,  24,  0,  1.54179615070802E-02
   9.54345649152,    0.00636578235,    0.09883010532,  25,  0,  6.36688925795869E-03
  13.63341568476,    0.12813281966,   -1.84762349353,  26,  0,  1.28149176538761E-01
  26.98505934729,    0.00315310896,   -0.67695779504,  27,  0,  3.14021411295958E-03
   5.64270614135,    0.00457810849,    2.48905397685,  28,  0,  4.58616646269133E-03
6167.20701373239,    0.00046952241,   -0.06256606331,  29,  0,  4.69996021487511E-04
 121.75014283918,    0.00378105659,    2.33701446400,  30,  0,  3.78110593679657E-03
   9.61372605493,    0.00680979178,    2.24351539378,  31,  0,  6.80991990027044E-03
3232.60542850251,    0.00095409166,    2.94891573083,  32,  0,  9.55220945211275E-04
---- LTE ----
   0.00000000000 :trend:
   0.00000000000 :accel:
-23149.20517049263 :K0:
155012.86403920857 :level:
   1.48528349227,    0.06119324722,   -0.81587144677 0
  -1.58542198437,    0.05860016003,   -0.09435869440 0
   1.08236266260,    0.04327426233,   -2.36006476227 0
   0.22590714605,    0.42562911846,   -1.04176213780 0
   0.21688649486,    0.41614446973,    2.53620808514 0
  -2.44665676404,    0.03741543445,   -2.03052461009 0
   2.25193222656,    0.06251476911,    1.43287099702 0
  -0.62944408309,    0.03617341447,   -2.41399433813 0
   0.50816087397,    0.03567874134,    2.00000883688 0
   0.00011913514, 30925557.68728981910,   -0.00501246638 0
 -76.18462701632,    0.02298421270,    2.95582789775 1
-609.47701613053,    0.10427850297,    1.68409840263 8

CC 0.3599551384 0.7707615926 1 1
0.99999994763:dLOD:
PS C:\Users\pp\github\pukpr\GeoEnergyMath\qbo> notepad enso_opt.exe.resp
PS C:\Users\pp\github\pukpr\GeoEnergyMath\qbo> ..\io\backup amo-abs-pt36pt77pt999999947

.\eexp.exe 0.75 0.2"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment