public override void GenerateTheorFeature(TargetBase mt) { Check.Require(mt != null, this.Name + " failed; CurrentMassTag hasn't been declared"); //Check.Require(results.Run.CurrentMassTag.EmpiricalFormula!=null, this.Name + "failed; Problem with EmpiricalFormular of current mass tag."); //XYData theorXYData = new XYData(); //for (int i = 0; i < mt.IsotopicProfile.Peaklist.Count; i++) //{ // XYData peakXYData = getTheorPeakData(mt.IsotopicProfile.Peaklist[i], fwhm); //} //distributionCreator.MolecularFormula = new MolecularFormula(); //distributionCreator.getIsotopicProfile(); //distributionCreator.OffsetDistribution(result.IsotopicProfile); //AreaFitter areafitter = new AreaFitter(distributionCreator.Data, result.Run.XYData, 10); //double fitval = areafitter.getFit(); //if (fitval == double.NaN || fitval > 1) fitval = 1; //result.IsotopicProfile.Score = fitval; }
public void HandTarget(TargetBase target) { targetGameObject = target.gameObject; targetBase = target; targetGameObject.transform.SetParent(targetRoot, false); targetGameObject.transform.localPosition = Vector3.zero; }
public override void GenerateTheorFeature(TargetBase mt) { Check.Require(mt != null, "FeatureGenerator failed. MassTag not defined."); Check.Require(!string.IsNullOrEmpty(mt.EmpiricalFormula), "Theoretical feature generator failed. Can't retrieve empirical formula from Mass Tag"); switch (LabelingType) { case Globals.LabelingType.NONE: mt.IsotopicProfile = GetUnlabeledIsotopicProfile(mt); break; case Globals.LabelingType.O18: throw new NotImplementedException(); case Globals.LabelingType.N15: mt.IsotopicProfileLabeled = _N15IsotopicProfileGenerator.GetN15IsotopicProfile2(mt, LowPeakCutOff); break; case Globals.LabelingType.Deuterium: //mt.IsotopicProfile = GetUnlabeledIsotopicProfile(mt); //mt.IsotopicProfileLabeled = _DeuteriumIsotopicProfileGenerator.GetDHIsotopicProfile2(mt, LowPeakCutOff, FractionLabeling, MolarMixingFraction); //swap so we can keep the normal in labeled box and use the D/H for general processing mt.IsotopicProfile = GetUnlabeledIsotopicProfile(mt);//needed for _DeuteriumIsotopicProfileGenerator mt.IsotopicProfile = _DeuteriumIsotopicProfileGenerator.GetDHIsotopicProfile2(mt, LowPeakCutOff, FractionLabeling, MolarMixingFraction); mt.IsotopicProfileLabeled = GetUnlabeledIsotopicProfile(mt); break; default: throw new NotImplementedException(); } }
public override void GenerateTheorFeature(TargetBase mt) { Check.Require(mt != null, "FeatureGenerator failed. MassTag not defined."); if (mt == null) { return; } Check.Require(mt.EmpiricalFormula != null, "Theoretical feature generator failed. Can't retrieve empirical formula from Mass Tag"); switch (LabelingType) { case Globals.LabelingType.NONE: mt.IsotopicProfile = GetUnlabeledIsotopicProfile(mt); break; case Globals.LabelingType.O18: throw new NotImplementedException(); case Globals.LabelingType.N15: mt.IsotopicProfileLabeled = _N15IsotopicProfileGenerator.GetN15IsotopicProfile(mt, LowPeakCutOff); break; default: break; } }
private IsotopicProfile GetUnlabelledIsotopicProfile(TargetBase mt) { var iso = new IsotopicProfile(); try { //empirical formula may contain non-integer values for iso = _isotopicDistCalculator.GetIsotopePattern(mt.EmpiricalFormula); } catch (Exception ex) { throw new Exception("Theoretical feature generator failed. Details: " + ex.Message); } PeakUtilities.TrimIsotopicProfile(iso, LowPeakCutOff); iso.ChargeState = mt.ChargeState; if (iso.ChargeState != 0) { calculateMassesForIsotopicProfile(iso, mt.MonoIsotopicMass, mt.ChargeState); } return(iso); }
private void SpawnTargets(List <ShootingGalleryTargetModel> newTargets) { List <TargetBase> spawnedTargets = new List <TargetBase>(); //Pass this to whatever will handle the targets foreach (ShootingGalleryTargetModel target in newTargets) { GameObject prefab = null; foreach (TargetPrefabPair targetPair in potentialTargets) { if (targetPair.id.Equals(target.id)) { prefab = targetPair.prefab; } } if (prefab == null) { LSLog.LogError($"Could not find a prefab for target with an ID of {target.id}... will use default"); prefab = defaultTarget; } GameObject newTarget = Instantiate(prefab); TargetBase targetBase = newTarget.GetComponent <TargetBase>(); targetBase.Init(target); targetObjectsSpawned.Add(targetBase); spawnedTargets.Add(targetBase); } targetHolder.Initialize(spawnedTargets); targetHolder.Reset(); }
public virtual void Render(TargetBase target) { if (!Show) { return; } if (_effectGraph == null) { return; } var context2D = target.DeviceManager.ContextDirect2D; context2D.BeginDraw(); if (EnableClear) { context2D.Clear(Color.Black); } context2D.Clear(Color.Transparent); context2D.DrawImage(_effectGraph.Output, InterpolationMode.Linear, CompositeMode.DestinationAtop); context2D.EndDraw(); }
/// <summary> /// Renders the model. /// </summary> /// <param name="render">The render.</param> private void Render(TargetBase render) { foreach (Element3D e in this.Items) { e.Render(render); } }
public void Render(TargetBase target) { var d3dContext = target.DeviceManager.ContextDirect3D; var d2dContext = target.DeviceManager.ContextDirect2D; // Set targets (This is mandatory in the loop) d3dContext.OutputMerger.SetTargets(target.DepthStencilView, target.RenderTargetView); // Clear the views d3dContext.ClearDepthStencilView(target.DepthStencilView, DepthStencilClearFlags.Depth, 1.0f, 0); if (EnableClear) { d3dContext.ClearRenderTargetView(target.RenderTargetView, new Color4(0.0f, 0.0f, 0.0f, 0.0f)); } spriteBatch.Begin(target); for (int i = 0; i < 50; i++) { spriteBatch.Draw(_textureDot, _currentPointerPosition * new Vector2(1, -1)); } spriteBatch.End(); }
private clsMassTag convertDeconToolsMassTagToMultialignMassTag(TargetBase mt) { var multialignMassTag = new clsMassTag(); multialignMassTag.Id = mt.ID; multialignMassTag.Charge1FScore = 0; multialignMassTag.Charge2FScore = 0; multialignMassTag.Charge3FScore = 0; multialignMassTag.ChargeState = mt.ChargeState; multialignMassTag.CleavageState = -1; multialignMassTag.DiscriminantMax = 0; //multialignMassTag.DriftTime = 0; multialignMassTag.HighPeptideProphetProbability = 0; multialignMassTag.Mass = mt.MonoIsotopicMass; multialignMassTag.ModCount = -1; multialignMassTag.Modifications = String.Empty; multialignMassTag.MSGFSpecProbMax = 0; multialignMassTag.MSMSObserved = mt.ObsCount; multialignMassTag.NetAverage = mt.NormalizedElutionTime; multialignMassTag.NetPredicted = -1; multialignMassTag.NetStandardDeviation = 0; multialignMassTag.Peptide = mt.Code; multialignMassTag.PeptideEx = String.Empty; multialignMassTag.XCorr = -1; return(multialignMassTag); }
public virtual void Render(TargetBase target) { if (!Show) { return; } if (_waveEffect == null) { return; } UpdateSize(target); var context2D = target.DeviceManager.ContextDirect2D; Update(); context2D.BeginDraw(); if (EnableClear) { context2D.Clear(Color.CornflowerBlue); } context2D.DrawImage(_waveEffect); context2D.EndDraw(); }
public void Render(TargetBase target) { var d3dContext = target.DeviceManager.ContextDirect3D; float width = (float)target.RenderTargetSize.Width; float height = (float)target.RenderTargetSize.Height; // Prepare matrices var view = Matrix.LookAtLH(new Vector3(0, 0, -5), new Vector3(0, 0, 0), Vector3.UnitY); var proj = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, width / (float)height, 0.1f, 100.0f); var viewProj = Matrix.Multiply(view, proj); var time = (float)(clock.ElapsedMilliseconds / 1000.0); // Set targets (This is mandatory in the loop) d3dContext.OutputMerger.SetTargets(target.DepthStencilView, target.RenderTargetView); // Clear the views d3dContext.ClearDepthStencilView(target.DepthStencilView, DepthStencilClearFlags.Depth, 1.0f, 0); if (EnableClear) { d3dContext.ClearRenderTargetView(target.RenderTargetView, new Color4(0.0f, 0.0f, 0.0f, 0.0f)); } if (ShowCube) { // Calculate WorldViewProj var worldViewProj = Matrix.Scaling(Scale) * Matrix.RotationX(time) * Matrix.RotationY(time * 2.0f) * Matrix.RotationZ(time * .7f) * viewProj; worldViewProj.Transpose(); // Setup the pipeline d3dContext.InputAssembler.SetVertexBuffers(0, vertexBufferBinding); d3dContext.InputAssembler.InputLayout = layout; d3dContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList; d3dContext.VertexShader.SetConstantBuffer(0, constantBuffer); d3dContext.VertexShader.Set(vertexShader); d3dContext.PixelShader.SetShaderResource(0, textureView); d3dContext.PixelShader.SetSampler(0, sampler); d3dContext.PixelShader.Set(pixelShader); // Update Constant Buffer d3dContext.UpdateSubresource(ref worldViewProj, constantBuffer, 0); // Draw the cube d3dContext.Draw(36, 0); } }
public override void GenerateTheorFeature(TargetBase mt) { Check.Require(mt != null, "FeatureGenerator failed. Target must not be null."); var iso = IsotopicDistCalculator.GetAveraginePattern(mt.MZ); PeakUtilities.TrimIsotopicProfile(iso, LowPeakCutOff); iso.ChargeState = mt.ChargeState; mt.IsotopicProfile = iso; }
private void UpdateSize(TargetBase target) { var localSize = new Size2((int)target.RenderTargetSize.Width, (int)target.RenderTargetSize.Height); if (localSize != screenSize) { screenSize = localSize; bitmapSourceEffect.ScaleSource = new Vector2((float)screenSize.Width / imageSize.Width, (float)screenSize.Height / imageSize.Height); } }
public void Stop() { if (_target != null) { _target.Shutdown(); _target = null; } _subscriptions.Shutdown(); _subscriptions = new BoardSubscriptionManager(); }
private IsotopicProfile getTheorProfile(TargetBase massTag, Globals.IsotopicProfileType isotopicProfileType) { switch (isotopicProfileType) { case Globals.IsotopicProfileType.UNLABELED: return(massTag.IsotopicProfile); case Globals.IsotopicProfileType.LABELED: return(massTag.IsotopicProfileLabeled); default: return(massTag.IsotopicProfile); } }
public override void Render(TargetBase render) { base.Render(render); var context = render.DeviceManager.ContextDirect3D; var width = render.RenderTargetSize.Width; var height = render.RenderTargetSize.Height; // Prepare matrices var view = global::SharpDX.Matrix.LookAtLH(new global::SharpDX.Vector3(0, 0, -5), new global::SharpDX.Vector3(0, 0, 0), global::SharpDX.Vector3.UnitY); var proj = global::SharpDX.Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, (float)(width / height), 0.1f, 100.0f); var viewProj = global::SharpDX.Matrix.Multiply(view, proj); var time = (float)(this.clock.ElapsedMilliseconds / 1000.0); // Set targets (This is mandatory in the loop) context.OutputMerger.SetTargets(render.DepthStencilView, render.RenderTargetView); // Clear the views context.ClearDepthStencilView(render.DepthStencilView, global::SharpDX.Direct3D11.DepthStencilClearFlags.Depth, 1.0f, 0); if (this.EnableClear) { context.ClearRenderTargetView(render.RenderTargetView, global::SharpDX.Color.LightGray); } if (this.ShowCube) { // Calculate WorldViewProj var worldViewProj = global::SharpDX.Matrix.Scaling((float)this.Scale) * global::SharpDX.Matrix.RotationX((float)this.RotationSpeed * time) * global::SharpDX.Matrix.RotationY((float)this.RotationSpeed * time * 2.0f) * global::SharpDX.Matrix.RotationZ((float)this.RotationSpeed * time * .7f) * viewProj; worldViewProj.Transpose(); context.UpdateSubresource(ref worldViewProj, this.constantBuffer, 0); // Setup the pipeline context.InputAssembler.SetVertexBuffers(0, this.vertexBufferBinding); context.InputAssembler.InputLayout = this.layout; context.InputAssembler.PrimitiveTopology = global::SharpDX.Direct3D.PrimitiveTopology.TriangleList; context.VertexShader.Set(this.vertexShader); context.PixelShader.Set(this.pixelShader); context.VertexShader.SetConstantBuffer(0, this.constantBuffer); // Update Constant Buffer // Draw the cube context.Draw(36, 0); } }
private void calculateMassesForIsotopicProfile(IsotopicProfile iso, TargetBase mt) { if (iso?.Peaklist == null) { return; } for (var i = 0; i < iso.Peaklist.Count; i++) { var calcMZ = mt.MonoIsotopicMass / mt.ChargeState + Globals.PROTON_MASS + i * Globals.MASS_DIFF_BETWEEN_ISOTOPICPEAKS / mt.ChargeState; iso.Peaklist[i].XValue = calcMZ; } iso.MonoPeakMZ = iso.Peaklist[0].XValue; iso.MonoIsotopicMass = (iso.MonoPeakMZ - Globals.PROTON_MASS) * mt.ChargeState; }
void Shoot() { // A simple fire animation using particals. gunSmoke.Play(); // Raycast for targeting purposes. RaycastHit rayHit; // Player Player forward Going out to range if (Physics.Raycast(transform.position, transform.forward, out rayHit)) { range = rayHit.distance; } { // Set up target. What the ray hit. Target target = rayHit.transform.GetComponent <Target>(); TargetEnemy enemyTarget = rayHit.transform.GetComponent <TargetEnemy>(); TargetBase baseTarget = rayHit.transform.GetComponent <TargetBase>(); TargetTank tankTarget = rayHit.transform.GetComponent <TargetTank>(); //GameObject hitHere = Instantiate(hitEffect, transform.position + transform.forward * range, Quaternion.LookRotation(rayHit.point)); GameObject hitHere = Instantiate(hitEffect, rayHit.point, Quaternion.LookRotation(rayHit.normal)); Destroy(hitHere, 0.5f); Debug.DrawLine(transform.position, transform.position + transform.forward * range, Color.red); // Show me what the ray hit. // Debug.Log(rayHit.transform.name); if (enemyTarget != null) { // Target takes damage. enemyTarget.HitEnemy(damage); } // Only if targe is not zero, a valid targe is in range. if (target != null) { // Target takes damage. target.HitTarget(damage); } if (baseTarget != null) { baseTarget.HitBase(damage); } if (tankTarget != null) { tankTarget.HitBase(damage); } } }
void Update () { if( (GameManager.CurrentState == GameManager.GameState.GamePlayer || GameManager.CurrentState == GameManager.GameState.LevelWinOutro) && ((ifEditor() && Input.GetMouseButton(0)) || Input.touchCount > 0) ) { touching = true; ray = Camera.main.ScreenPointToRay(Input.mousePosition); //nextTouchTime <= Time.timeSinceLevelLoad //Debug.Log(nextTouchTime + " : " + Time.timeSinceLevelLoad); if (playerTrail != null) { playerTrail.transform.position = ray.origin; } nextTouchTime = Time.timeSinceLevelLoad; if (Physics.Raycast(ray, out hit, 100f)) { // HIT if (GameManager.CurrentState == GameManager.GameState.GamePlayer) { hitBase = hit.collider.gameObject.GetComponent<TargetBase>(); if (hitBase != null) { if (GameManager.HandleHitID(hitBase, ref CurrentPlayerHitsID)) { hitBase.ShowHit(); Debug.Log("HIT: " + CurrentPlayerHitsID); GameManager.EvaluatePlayerState(); } } } } } else { touching = false; } if (playerTrail != null) { playerTrail.SetActive(touching); } }
public void Begin(TargetBase render) { //var d3dContext = render.DeviceManager.ContextDirect3D; //var d2dContext = render.DeviceManager.ContextDirect2D; //m_d3dContext = d3dContext; m_renderTargetSize = new Vector2((float)render.RenderTargetSize.Width, (float)render.RenderTargetSize.Height); m_width = (float)render.RenderTargetSize.Width; m_height = (float)render.RenderTargetSize.Height; m_dpi = Windows.Graphics.Display.DisplayProperties.LogicalDpi; m_view = Matrix.LookAtLH(new Vector3(0, 0, -1), new Vector3(0, 0, 0), Vector3.UnitY); m_projection = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, m_width / (float)m_height, 0.1f, 2.0f); m_viewProj = Matrix.Multiply(m_view, m_projection); }
public IsotopicProfile GetN15IsotopicProfile(TargetBase mt, double lowpeakCutoff) { Check.Require(mt != null, "Mass tag not defined"); Check.Require(mt.IsotopicProfile != null, "Mass tag's theor isotopic profile not defined"); Check.Require(mt.ChargeState != 0, "Can't have a charge state of '0'"); var numNitrogens = mt.GetAtomCountForElement("N"); var labeledTheorProfile = _TomIsotopicPatternGenerator.GetIsotopePattern(mt.EmpiricalFormula, _TomIsotopicPatternGenerator.aafN15Isos); addMZInfoToTheorProfile(mt.IsotopicProfile, labeledTheorProfile, numNitrogens, mt.ChargeState); PeakUtilities.TrimIsotopicProfile(labeledTheorProfile, lowpeakCutoff); labeledTheorProfile.ChargeState = mt.ChargeState; return(labeledTheorProfile); }
public IsotopicProfile GetN15IsotopicProfile2(TargetBase mt, double lowPeakCutoff) { Check.Require(mt != null, "Mass tag not defined"); Check.Require(mt.IsotopicProfile != null, "Mass tag's theor isotopic profile not defined"); Check.Require(mt.ChargeState != 0, "Can't have a charge state of '0'"); var nitrogenCount = mt.GetAtomCountForElement("N"); _isotopicDistributionCalculator.SetLabeling("N", N14ISOTOPE_NUMBER, this.N14LabelingAmount, N15ISOTOPE_NUMBER, this.N15LabelingAmount); var labeledTheorProfile = _isotopicDistributionCalculator.GetIsotopePattern(mt.EmpiricalFormula); addMZInfoToTheorProfile(mt.IsotopicProfile, labeledTheorProfile, nitrogenCount, mt.ChargeState); _isotopicDistributionCalculator.ResetToUnlabeled(); PeakUtilities.TrimIsotopicProfile(labeledTheorProfile, lowPeakCutoff); labeledTheorProfile.ChargeState = mt.ChargeState; return(labeledTheorProfile); }
private void StartIntegration(IEnumerable <System.Type> types) { const string noConfigMessage = "\n\nThis Service has not been configured or the configuration has changed.\n\nUse the Configuration Utility to configure and activate Integrations.\n\n"; var configuration = LoadConfiguration(); // pick correct implementation class for specified target type if (configuration != null && configuration.Target != null && !string.IsNullOrEmpty(configuration.Target.Type)) { var targetType = configuration.Target.Type.ToLowerInvariant(); var implementations = types.Where(x => x.IsClass && !x.IsAbstract && x.IsSubclassOf(typeof(TargetBase))).ToList(); if (!implementations.Any()) { "No integrations found.".Print(); noConfigMessage.Print(); } var implementation = implementations.FirstOrDefault(x => x.Name.ToLowerInvariant() == targetType); if (implementation != null) { _target = (TargetBase)Activator.CreateInstance(implementation, _subscriptions); new Thread(_target.Process).Start(); } else { string.Format("No integration found matching [{0}]. Valid integrations are : {1}", targetType, string.Join(", ", implementations.Select(x => x.Name).ToList())).Print(); noConfigMessage.Print(); } } else { noConfigMessage.Print(); } }
private IsotopicProfile GetUnlabeledIsotopicProfile(TargetBase mt) { IsotopicProfile iso; try { iso = _tomIsotopicPatternGenerator.GetIsotopePattern(mt.EmpiricalFormula, _tomIsotopicPatternGenerator.aafIsos); } catch (Exception ex) { throw new Exception("Theoretical feature generator failed. Details: " + ex.Message); } PeakUtilities.TrimIsotopicProfile(iso, LowPeakCutOff); iso.ChargeState = mt.ChargeState; if (iso.ChargeState != 0) { calculateMassesForIsotopicProfile(iso, mt); } return(iso); }
private void CalculateEmpiricalFormulas(TargetCollection data) { var peptideUtils = new PeptideUtils(); foreach (var targetBase in data.TargetList) { var peptide = (PeptideTarget)targetBase; var baseEmpiricalFormula = peptideUtils.GetEmpiricalFormulaForPeptideSequence(peptide.Code); if (peptide.ContainsMods) { TargetBase peptide1 = peptide; var mods = (from n in _massTagModData where n.Item1 == peptide1.ID select n); foreach (var tuple in mods) { baseEmpiricalFormula = EmpiricalFormulaUtilities.AddFormula(baseEmpiricalFormula, tuple.Item4); } } peptide.EmpiricalFormula = baseEmpiricalFormula; } }
public void DestroyTargetByUID(string uid) { TargetBase deadTarget = null; foreach (TargetBase target in targetObjectsSpawned) { if (target.UID.Equals(uid)) { deadTarget = target; break; } } if (deadTarget != null) { deadTarget.Explode(); targetCount--; } else { LSLog.LogError($"Could not find a target object with uid {uid}"); } }
public virtual void Render(TargetBase target) { if (!Show) { return; } IRenderableScreenCopy screenCopy = this.screen.GetScreenCopy(); var context2D = target.DeviceManager.ContextDirect2D; context2D.BeginDraw(); context2D.Transform = Matrix.Identity; context2D.Clear(TerminalBackgroundColor); RectangleF rect = new RectangleF(); var lines = screenCopy.Cells; for (int y = 0; y < lines.Count(); y++) { var cols = lines[y]; rect.Top = y * CellHeight; rect.Bottom = rect.Top + CellHeight; for (int x = 0; x < cols.Count(); x++) { var cell = cols[x]; rect.Left = x * CellWidth; rect.Right = rect.Left + CellWidth; bool isCursor = !screenCopy.CursorHidden && y == screenCopy.CursorRow && x == screenCopy.CursorColumn; this.DrawCell(target, rect, cell, isCursor, screenCopy.HasFocus); } } context2D.EndDraw(); }
public static bool HandleHitID(TargetBase target, ref string list) { if (!list.Contains(target.id.ToString())) { list+= target.id; return true; } return false; }
/// <summary> /// Renders the element. /// </summary> /// <param name="render">The render.</param> public virtual void Render(TargetBase render) { }
private void OutputMassSpectrum(string outputFolder, XYData massSpectrumXYData, TargetBase target, SipperLcmsTargetedResult sipperLcmsTargetedResult) { var msGraphGenerator = new MSGraphControl(); msGraphGenerator.SymbolType = SymbolType.None; if (massSpectrumXYData == null) { massSpectrumXYData = new XYData(); massSpectrumXYData.Xvalues = new double[] { 0, 1, 2, 3, 4, 5 }; massSpectrumXYData.Yvalues = new double[] { 0, 1, 2, 3, 4, 5 }; } msGraphGenerator.GenerateGraph(massSpectrumXYData.Xvalues, massSpectrumXYData.Yvalues, target.MZ - 2, target.MZ + 6); var annotation = "fractionC13= " + sipperLcmsTargetedResult.PercentCarbonsLabelled.ToString("0.000") + "\n" + "populationFraction= " + sipperLcmsTargetedResult.PercentPeptideLabelled.ToString("0.000"); msGraphGenerator.AddAnnotationRelativeAxis(annotation, 0.45, 0.05); var outputFilename = Path.Combine(outputFolder, target.ID + "_MS.png"); msGraphGenerator.SaveGraph(outputFilename); }
public IsotopicProfile GetDHIsotopicProfile2(TargetBase mt, double lowpeakCutoff, double fractionLabeling, double molarMixingofH) { Check.Require(mt != null, "Mass tag not defined"); Check.Require(mt.IsotopicProfile != null, "Mass tag's theor isotopic profile not defined"); Check.Require(mt.ChargeState != 0, "Can't have a charge state of '0'"); //int numNitrogens = mt.GetAtomCountForElement("N"); var numDeuterium = 0; //_isotopicDistributionCalculator.SetLabeling("H", H_ISOTOPE_NUMBER, this.HLabelingAmount, D_ISOTOPE_NUMBER, this.DLabelingAmount); var hydrogenTheoreticalProfile = _isotopicDistributionCalculator.GetIsotopePattern(mt.EmpiricalFormula); var deuteriumTheoreticalProfile = _isotopicDistributionCalculator.GetIsotopePattern(mt.EmpiricalFormula); HLabelingAmount = molarMixingofH; DLabelingAmount = 1 - molarMixingofH; //convert to floats var labelingAmountFraction = Convert.ToSingle(fractionLabeling); var HLabelingAmountMix = Convert.ToSingle(HLabelingAmount); var DLabelingAmountMix = Convert.ToSingle(DLabelingAmount); //initialization float maxHeightForNormalization = 0; if (hydrogenTheoreticalProfile.Peaklist.Count > 0) { maxHeightForNormalization = hydrogenTheoreticalProfile.Peaklist[0].Height * HLabelingAmountMix; } //add deuterated peaks as an offset index for (var i = 0; i < hydrogenTheoreticalProfile.Peaklist.Count; i++) { var peakH = hydrogenTheoreticalProfile.Peaklist[i]; MSPeak peakD; if (i == 0) //initial peak where there is no D contribution { peakD = new MSPeak(0); } else { peakD = deuteriumTheoreticalProfile.Peaklist[i - 1]; } var contributionH = peakH.Height * HLabelingAmountMix; var contributionD = (1 - labelingAmountFraction) * peakD.Height * DLabelingAmountMix + labelingAmountFraction * peakD.Height * DLabelingAmountMix; peakH.Height = contributionH + contributionD; //peakH.Height = peakH.Height + (1-Convert.ToSingle(fractionLabeling)) * peakD.Height +Convert.ToSingle(fractionLabeling) * peakD.Height; //find true hightes peak in combined distribusion if (peakH.Height > maxHeightForNormalization) { maxHeightForNormalization = peakH.Height; } } //rename for clarity var labeledTheoreticalProfile = hydrogenTheoreticalProfile; //normalize to 1 foreach (var peak in labeledTheoreticalProfile.Peaklist) { peak.Height /= maxHeightForNormalization; } //should be good up to here addMZInfoToTheorProfile(mt.IsotopicProfile, labeledTheoreticalProfile, numDeuterium, mt.ChargeState);//Keep this as the H mass? //_isotopicDistributionCalculator.ResetToUnlabeled(); PeakUtilities.TrimIsotopicProfile(labeledTheoreticalProfile, lowpeakCutoff); labeledTheoreticalProfile.ChargeState = mt.ChargeState; return(labeledTheoreticalProfile); }
private void SetTarget(TargetBase target) { if (target != null) { GameManager.HandleHitID(target, ref CurrentTargetsID); CurrentState = State.Moving; Vector3 from = transform.position; Vector3 to = target.transform.position; Tweener.TweenDelegate[] easings = new Tweener.TweenDelegate[]{ Easing.Linear }; Tweener.TweenDelegate randomEasing = easings[Random.Range(0, easings.Length-1)]; tweener.easeFromTo(from, to, 0.5f, randomEasing, TargetNextTarget); Debug.Log("AI CurrentTarget: " + target.id); target.Activate(); } else { CurrentState = State.Waiting; Debug.Log("AI Waits for: " + CurrentTargetsID); Invoke("SetAIDoneState", DoneWaitTime); } }