<commit_before>package main

import (
	"flag"
	"fmt"
	"log"
	"math"
	"os"
	"sync"
	"time"

	"github.com/ChristopherRabotin/gokalman"
	"github.com/ChristopherRabotin/smd"
	"github.com/gonum/matrix/mat64"
	"github.com/soniakeys/meeus/julian"
)

// Scenario constants
const (
	smoothing = true
	initJDE   = 2456296.25
	realBT    = 7009.767
	realBR    = 140002.894
)

var (
	σQExponent float64
	measFile   string
	wg         sync.WaitGroup
)

var debug = flag.Bool("debug", false, "verbose debug")

func init() {
	flag.Float64Var(&σQExponent, "sigmaExp", 6, "exponent for the Q sigma (default is 6, so sigma=1e-6).")
	flag.StringVar(&measFile, "meas", "z", "measurement file number")
}

var (
	timeStep       = 30 * time.Second
	σρ             = math.Pow(5e-3, 2) // m , but all measurements in km.
	σρDot          = math.Pow(5e-6, 2) // m/s , but all measurements in km/s.
	_DSS34Canberra = smd.NewSpecialStation("DSS34Canberra", 0.691750, 0, -35.398333, 148.981944, σρ, σρDot, 7)
	//_DSS65Madrid    = smd.NewSpecialStation("DSS65Madrid", 0.834939, 0, 40.427222, 355.749444, σρ, σρDot, 7)
	_DSS65Madrid    = smd.NewSpecialStation("DSS65Madrid", 0.834939, 0, 40.427222, 4.250556, σρ, σρDot, 7)
	_DSS13Goldstone = smd.NewSpecialStation("DSS13Goldstone", 1.07114904, 0, 35.247164, 243.205, σρ, σρDot, 7)
)

func main() {
	flag.Parse()
	if measFile != "a" && measFile != "b" {
		log.Fatalf("unknown file `%s` (should be a or b)", measFile)
	}
	startDT := julian.JDToTime(initJDE)
	// Load measurements
	measurements, startDT, endDT := loadMeasurementFile(measFile, startDT)
	log.Printf("[info] Loaded %d measurements from %s to %s", len(measurements), startDT, endDT)

	// Compute number of states which will be generated.
	numStates := int(endDT.Sub(startDT).Seconds()/timeStep.Seconds()) + 1
	residuals := make([]*mat64.Vector, numStates)

	// Get the first measurement as an initial orbit estimation.
	firstDT := startDT
	estOrbit := smd.NewOrbitFromRV([]float64{-274096790.0, -92859240.0, -40199490.0}, []float64{32.67, -8.94, -3.88}, smd.Earth)
	startDT = firstDT.Add(-timeStep)
	// Perturbations in the estimate
	estPerts := smd.Perturbations{PerturbingBody: &smd.Sun, Drag: true}

	stateEstChan := make(chan (smd.State))
	sc := smd.NewEmptySC("prj0", 0)
	sc.Drag = 1.2
	mEst := smd.NewPreciseMission(sc, estOrbit, startDT, startDT.Add(-1), estPerts, timeStep, true, smd.ExportConfig{Filename: "prj0", Cosmo: true})
	mEst.RegisterStateChan(stateEstChan)
<commit_msg>Add information for meas file b<commit_after>package main

import (
	"flag"
	"fmt"
	"log"
	"math"
	"os"
	"sync"
	"time"

	"github.com/ChristopherRabotin/gokalman"
	"github.com/ChristopherRabotin/smd"
	"github.com/gonum/matrix/mat64"
	"github.com/soniakeys/meeus/julian"
)

// Scenario constants
const (
	smoothing = false
	initJDE   = 2456296.25
	realBT    = 7009.767
	realBR    = 140002.894
)

var (
	σQExponent float64
	measFile   string
	wg         sync.WaitGroup
)

var debug = flag.Bool("debug", false, "verbose debug")

func init() {
	flag.Float64Var(&σQExponent, "sigmaExp", 6, "exponent for the Q sigma (default is 6, so sigma=1e-6).")
	flag.StringVar(&measFile, "meas", "z", "measurement file number")
}

var (
	timeStep        = 30 * time.Second
	σρ              = math.Pow(5e-3, 2) // m , but all measurements in km.
	σρDot           = math.Pow(5e-6, 2) // m/s , but all measurements in km/s.
	_DSS34Canberra  = smd.NewSpecialStation("DSS34Canberra", 0.691750, 0, -35.398333, 148.981944, σρ, σρDot, 7)
	_DSS65Madrid    = smd.NewSpecialStation("DSS65Madrid", 0.834939, 0, 40.427222, 4.250556, σρ, σρDot, 7)
	_DSS13Goldstone = smd.NewSpecialStation("DSS13Goldstone", 1.07114904, 0, 35.247164, 243.205, σρ, σρDot, 7)
)

func main() {
	flag.Parse()
	if measFile != "a" && measFile != "b" {
		log.Fatalf("unknown file `%s` (should be a or b)", measFile)
	}
	if measFile == "b" {
		_DSS65Madrid = smd.NewSpecialStation("DSS65Madrid", 0.834939, 0, 40.427222, 355.749444, σρ, σρDot, 7)
	}
	startDT := julian.JDToTime(initJDE)
	// Load measurements
	measurements, startDT, endDT := loadMeasurementFile(measFile, startDT)
	log.Printf("[info] Loaded %d measurements from %s to %s", len(measurements), startDT, endDT)

	// Compute number of states which will be generated.
	numStates := int(endDT.Sub(startDT).Seconds()/timeStep.Seconds()) + 1
	residuals := make([]*mat64.Vector, numStates)

	// Get the first measurement as an initial orbit estimation.
	firstDT := startDT
	var estOrbit *smd.Orbit
	if measFile == "a" {
		estOrbit = smd.NewOrbitFromRV([]float64{-274096790.0, -92859240.0, -40199490.0}, []float64{32.67, -8.94, -3.88}, smd.Earth)
	} else {
		estOrbit = smd.NewOrbitFromRV([]float64{-274096770.76544, -92859266.4499061, -40199493.6677441}, []float64{32.6704564599943, -8.93838913761049, -3.87881914050316}, smd.Earth)
	}
	startDT = firstDT.Add(-timeStep)
	// Perturbations in the estimate
	estPerts := smd.Perturbations{PerturbingBody: &smd.Sun, Drag: true}

	stateEstChan := make(chan (smd.State))
	sc := smd.NewEmptySC("prj0", 0)
	if measFile == "a" {
		sc.Drag = 1.2
	} else {
		sc.Drag = 1.0
	}
	mEst := smd.NewPreciseMission(sc, estOrbit, startDT, startDT.Add(-1), estPerts, timeStep, true, smd.ExportConfig{Filename: "prj0", Cosmo: true})
	mEst.RegisterStateChan(stateEstChan)

{'fraction_non_alphanumeric': 0.15314459433783015, 'fraction_numerical': 0.09823294698840965, 'mean_word_length': 4.042145593869732, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4869958', 'n_tokens_mistral': 2516, 'n_tokens_neox': 2149, 'n_words': 467}