Example #1
0
	void LerpLight(LightProfile start, LightProfile end, float t) {
		if(light == null) {
			Debug.LogWarning("--No light found in Jar--//Try adding a light to the jar script");
			return;
		}
		light.color = Color.Lerp(start.color, end.color, t);
		light.range = Mathf.Lerp(start.range, end.range, t);
		light.intensity = Mathf.Lerp(start.intensity, end.intensity, t);
	}
    public static void Initialize()
    {
        //TODO: Change the creation of profiles to GetEnumerableOfType instead of hard coding
        ScaleProfile scaleProfile = ScriptableObject.CreateInstance <ScaleProfile>();

        AssetDatabase.CreateAsset(scaleProfile, "Assets/VRGazeInteraction/CoreFramework/AnimationFramework/Profiles/ScaleProfile.asset");

        MoveProfile moveProfile = ScriptableObject.CreateInstance <MoveProfile>();

        AssetDatabase.CreateAsset(moveProfile, "Assets/VRGazeInteraction/CoreFramework/AnimationFramework/Profiles/MoveProfile.asset");

        LightProfile lightProfile = ScriptableObject.CreateInstance <LightProfile>();

        AssetDatabase.CreateAsset(lightProfile, "Assets/VRGazeInteraction/CoreFramework/AnimationFramework/Profiles/LightProfile.asset");


        AssetDatabase.SaveAssets();
        Debug.Log("AnimationFramework initialized");
    }
Example #3
0
        public void ValidateScans(SilacCompoundInfo sci, double ppmTolerance)
        {
            int lightMaxIndex = LightProfile.FindMaxIndex();
            int heavyMaxIndex = HeavyProfile.FindMaxIndex();

            var identified = ObservedEnvelopes.FindAll(m => m.IsIdentified);

            int minIdentifiedScan = identified.Min(m => m.Scan);
            int maxIdentifiedScan = identified.Max(m => m.Scan);

            ObservedEnvelopes.ForEach(m => m.Enabled = m.Scan >= minIdentifiedScan && m.Scan <= maxIdentifiedScan);

            int enabledCount = ObservedEnvelopes.FindAll(m => m.Enabled).Count;

            if (enabledCount < 5)
            {
                int preEnabled = (5 - enabledCount) / 2;
                if (preEnabled == 0)
                {
                    preEnabled = 1;
                }
                int postEnabled = 5 - enabledCount - preEnabled;

                int first = ObservedEnvelopes.FindIndex(m => m.Enabled);
                for (int i = first - 1; i >= 0 && i >= first - preEnabled; i--)
                {
                    ObservedEnvelopes[i].Enabled = true;
                }

                int last = ObservedEnvelopes.FindLastIndex(m => m.Enabled);
                for (int i = last + 1; i < ObservedEnvelopes.Count && i <= last + postEnabled; i++)
                {
                    ObservedEnvelopes[i].Enabled = true;
                }
            }

            var enabled = ObservedEnvelopes.FindAll(m => m.Enabled);

            var lightAccumulator = new MeanStandardDeviation(from ob in enabled
                                                             let ppm = PrecursorUtils.mz2ppm(sci.Light.Profile[lightMaxIndex].Mz, sci.Light.Profile[lightMaxIndex].Mz - ob.Light[lightMaxIndex].Mz)
                                                                       select ppm);

            var heavyAccumulator = new MeanStandardDeviation(from ob in enabled
                                                             let ppm = PrecursorUtils.mz2ppm(sci.Heavy.Profile[heavyMaxIndex].Mz, sci.Heavy.Profile[heavyMaxIndex].Mz - ob.Heavy[heavyMaxIndex].Mz)
                                                                       select ppm);

            double lightPPM = Math.Max(ppmTolerance, lightAccumulator.StdDev * 3);
            double heavyPPM = Math.Max(ppmTolerance, heavyAccumulator.StdDev * 3);

            var lightMinPPM = lightAccumulator.Mean - lightPPM;
            var lightMaxPPM = lightAccumulator.Mean + lightPPM;
            var heavyMinPPM = heavyAccumulator.Mean - heavyPPM;
            var heavyMaxPPM = heavyAccumulator.Mean + heavyPPM;

            int fixedIndex = ObservedEnvelopes.FindIndex(m => m.IsIdentified);

            for (int i = fixedIndex; i >= 0; i--)
            {
                var pair = ObservedEnvelopes[i];
                if (pair.Enabled)
                {
                    continue;
                }

                if (!AcceptScan(pair, sci, lightMaxIndex, lightMinPPM, lightMaxPPM, heavyMaxIndex, heavyMinPPM, heavyMaxPPM))
                {
                    break;
                }

                pair.Enabled = true;
            }

            for (int i = fixedIndex; i < ObservedEnvelopes.Count; i++)
            {
                var pair = ObservedEnvelopes[i];
                if (pair.Enabled)
                {
                    continue;
                }

                if (!AcceptScan(pair, sci, lightMaxIndex, lightMinPPM, lightMaxPPM, heavyMaxIndex, heavyMinPPM, heavyMaxPPM))
                {
                    break;
                }

                pair.Enabled = true;
            }
        }