public void Run() { //Put couch and gantry and home position var ms = MachineState.InitNew(); ms.Energy = Linacs.Energy._6X; //ms.CouchLat = 101; //ms.CouchLng = 101; //ms.CouchVert = 101; //ms.CouchRot = 181; //_linac.SetMachineState(ms); //Thread.Sleep(8000); ms.Time = 99; //Set through different x y jaw combos and beam on to film/portal var jawShows = JawShots.GetXYCalibrationShots(_linac); //jawShows.Run(); //Shoot a couple square fields to test for coincidence //jawShows = JawShots.GetLightFieldCoincidence(_linac); //jawShows.Run(); //TESTING FOR COUCH RELATIVE MOTION ACCURACY //Step couch 20 cm long and lat to shoot a square ms = _linac.GetMachineStateCopy(); ms.CouchLat += 8; ms.CouchLng += 8; ms.X1 = ms.X2 = ms.Y1 = ms.Y2 = 1; //2 x 2 field ms.MU = 400; _linac.SetMachineState(ms); _linac.BeamOn(); Thread.Sleep(_linac.WaitMsForMU(400)); //Move couch to other side shoot a square ms.CouchLat -= 16; ms.CouchLng -= 16; _linac.SetMachineState(ms); _linac.BeamOn(); Thread.Sleep(_linac.WaitMsForMU(400)); //Collimator Star //var cs = new CollimatorStarShot(_linac); //cs.Run(); //Couch Star var cos = new CouchStarShot(_linac); cos.Run(); }
public void Run() { if (string.IsNullOrEmpty(SavePath)) { Logger.Log("Save path is empty. Will save to desktop\n"); SavePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "mulinearity.txt"); } ; //Move to Scanning Depth Logger.Log("Moving scanning chamber...\n"); _scan1D.GoToDepth(ScanningDepthMM).Wait(); var ms = MachineState.InitNew(); ms.X1 = ms.X2 = ms.Y1 = ms.Y2 = 5; foreach (var en in energiesToTest) { foreach (var mu in musToTest) { var movingMs = ms.Copy(); movingMs.Energy = en; movingMs.MU = mu; var jr = new Job(movingMs); jr.DepthOfMeasurentMM = ScanningDepthMM; for (int n = 0; n < RepeatMeasurements; n++) { Logger.Log($"Working on {en}, {mu} MU, Measurement {n + 1}\n"); _linac.SetMachineState(movingMs); //Start measuring _el.Reset(); _el.StartMeasurement(); if (n == 0) { _linac.BeamOn(); } else { _linac.RepeatBeam(); } Thread.Sleep(_linac.WaitMsForMU(mu)); //Stop and get measurement _el.StopMeasurement(); var measured = _el.GetValue().Measurement; Logger?.Log($"Measured : {measured}\n"); //Save results jr.AddMeasurement(_el.GetValue().Measurement); } JobWriter.AppendResult(SavePath, jr); } } }
public void Run() { if (string.IsNullOrEmpty(SavePath)) { Logger.Log("Save path is empty. Will save to desktop\n"); SavePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "edwFactors.txt"); } ; var states = BuildMeasurementList(); foreach (var m in states) { var jr = new Job(m); jr.DepthOfMeasurentMM = DepthOfMeasurementMM; if (Math.Abs(_scan1D.LastKnowPositionMM - DepthOfMeasurementMM) > 0.1) { Logger.Log($"Changing depth to {DepthOfMeasurementMM} mm\n"); _scan1D.GoToDepth(jr.DepthOfMeasurentMM); } for (int n = 0; n < RepeatMeasurements; n++) { var fov = EnergyHelper.IsPhoton(m.Energy) ? $"{m.X1 * 2} x {m.Y1 * 2}" : m.Accessory; Logger.Log($"Working on {m.Energy}, Depth {jr.DepthOfMeasurentMM}, {m.Accessory} , Measurement {n + 1}\n\n"); _linac.SetMachineState(m); //Start measuring _el.Reset(); _el.StartMeasurement(); if (n == 0) { _linac.BeamOn(); } else { _linac.RepeatBeam(); } var waitTime = _linac.WaitMsForMU(m.MU, true); using (var t = new TimerLogger("Waiting on beam completion", waitTime, 1000, this.Logger)) { Thread.Sleep(waitTime); } //Stop and get measurement _el.StopMeasurement(); var measured = _el.GetValue().Measurement; Logger?.Log($"Measured : {measured}\n"); jr.AddMeasurement(_el.GetValue().Measurement); } //Save results JobWriter.AppendResult(SavePath, jr); } }
public void Run() { foreach (var shot in toShoot) { shot.MU = MUPerShot; _linac.SetMachineState(shot); _linac.BeamOn(); Thread.Sleep(_linac.WaitMsForMU(shot.MU)); for (int i = 1; i < RepeatMeasurements; i++) { _linac.RepeatBeam(); } } }
public void Run() { Logger?.Log($"=====COUCH STAR SHOT =====\n"); var ms = _linac.GetMachineStateCopy(); ms.X1 = ms.X2 = 0.2; ms.Y1 = 5; ms.Y2 = -3; ms.MU = MUPerShot; ms.CollimatorRot = 180; ms.GantryRot = 180; foreach (var angle in new double[] { 270, 245, 220, 195, 170, 145, 120 }) { Logger?.Log($"Moding up couch angle {angle}...\n"); ms.CouchRot = angle; _linac.SetMachineState(ms); _linac.BeamOn(); Thread.Sleep(_linac.WaitMsForMU(MUPerShot)); } }
/// <summary> /// Takes measurements using the electrometer and linac input /// </summary> /// <param name="el"></param> /// <param name="linac"></param> /// <param name="repeatBeam">flags whether or not this is a repeat measurement</param> /// <returns></returns> public double TakeMeasurement(IElectrometer el, CSeriesLinac linac, bool repeatBeam) { if (el != null) { el.StartMeasurement(); } if (linac != null) { var ms = MachineStateRun; if (repeatBeam) { linac.RepeatBeam(); } else { linac.BeamOn(); } Thread.Sleep(linac.WaitMsForMU(ms.MU, ms.Accessory != null && AccessoryHelper.IsEDW(ms.Accessory))); Thread.Sleep(1000); //Extra second to allow electrometer settling } if (el != null) { el.StopMeasurement(); } double val = double.NaN; if (el != null) { val = el.GetValue().Measurement; el.Reset(); } AddMeasurement(val); return(val); }
public void Run(bool photons = true, bool electrons = true) { if (string.IsNullOrEmpty(SavePath)) { Logger.Log("Save path is empty. Will save to desktop\n"); SavePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "outputFactors.txt"); } ; var measurementList = BuildMeasurementList(photons, electrons); foreach (var m in measurementList) { var jr = new Job(m); jr.DepthOfMeasurentMM = energyDepths[m.Energy]; _scan1D.GoToDepth(jr.DepthOfMeasurentMM); for (int n = 0; n < RepeatMeasurements; n++) { var fov = EnergyHelper.IsPhoton(m.Energy) ? $"{m.X1 * 2} x {m.Y1 * 2}" : m.Accessory; Logger.Log($"Working on {m.Energy}, Depth {jr.DepthOfMeasurentMM}, {fov} , Measurement {n + 1}"); var state = _linac.GetMachineStateCopy(); //Check for cone change if (_linac.GetMachineStateCopy().Accessory != m.Accessory) { Console.Beep(4000, 1000); Logger.Log($"Please change the cone to {m.Accessory}\n"); Logger.Log($"Press ENTER when complete\n"); while (Console.ReadKey().Key != ConsoleKey.Enter) { } Logger.Log($"{m.Accessory} inserted! Continuing...\n"); } _linac.SetMachineState(m); //Start measuring _el.Reset(); _el.StartMeasurement(); if (n == 0) { _linac.BeamOn(); } else { _linac.RepeatBeam(); } Thread.Sleep(_linac.WaitMsForMU(m.MU)); //Stop and get measurement _el.StopMeasurement(); var measured = _el.GetValue().Measurement; Logger?.Log($"Measured : {measured}\n"); jr.AddMeasurement(_el.GetValue().Measurement); } //Save results JobWriter.AppendResult(SavePath, jr); } }
public void Run() { if (string.IsNullOrEmpty(SavePath)) { Logger.Log("Save path is empty. Will save to desktop\n"); SavePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "outputs.txt"); } ; var measurementList = BuildMeasurementList(); BeamManager.SetFixed(); BeamManager.SetEnergy(Energy._6X); BeamManager.SetDoseRate(measurementList.First().MachineStateRun.DoseRate); foreach (var jr in measurementList) { Task depthTask = Task.Run(() => { }); if (_scan1D.GetCurrentDepthMM() != jr.DepthOfMeasurentMM) { depthTask = _scan1D.GoToDepth(jr.DepthOfMeasurentMM); } for (int n = 0; n < RepeatMeasurements; n++) { Logger.Log($"Working on {jr.MachineStateRun.Energy}, Depth {jr.DepthOfMeasurentMM}, Measurement {n + 1}\n"); var state = _linac.GetMachineStateCopy(); //Check for cone change if (_linac.GetMachineStateCopy().Accessory != jr.MachineStateRun.Accessory) { Console.Beep(4000, 1000); Logger.Log($"Please change the cone to {jr.MachineStateRun.Accessory}\n"); Logger.Log($"Press ENTER when complete\n"); while (Console.ReadKey().Key != ConsoleKey.Enter) { } Logger.Log($"{jr.MachineStateRun.Accessory} inserted! Continuing...\n"); } _linac.SetMachineState(jr.MachineStateRun); //Start measuring depthTask.Wait(); _el.Reset(); _el.StartMeasurement(); if (n == 0) { _linac.BeamOn(); } else { _linac.RepeatBeam(); } Thread.Sleep(_linac.WaitMsForMU(jr.MachineStateRun.MU)); //Stop and get measurement _el.StopMeasurement(); var measured = _el.GetValue().Measurement; Logger?.Log($"Measured : {measured}\n"); jr.AddMeasurement(_el.GetValue().Measurement); } //Save results JobWriter.AppendResult(SavePath, jr); } }