static void CreateAsset() { StaticFilter item = EditorUtil.CreateAsset <StaticFilter>(NMBEditorUtil.AssetLabel); EditorUtility.FocusProjectWindow(); Selection.activeObject = item; }
public IObservable <IChangeSet <TObject, TKey> > Connect(Func <TObject, bool> filter) { if (filter == null) { throw new ArgumentNullException(nameof(filter)); } return(Observable.Create <IChangeSet <TObject, TKey> > ( observer => { lock (_locker) { var filterer = new StaticFilter <TObject, TKey>(filter); var filtered = filterer.Filter(GetInitialUpdates()); if (filtered.Count != 0) { observer.OnNext(filtered); } return _changes .FinallySafe(observer.OnCompleted) .Select(filterer.Filter) .NotEmpty() .SubscribeSafe(observer); } })); }
/// <summary> /// Controls behavior of the inspector. /// </summary> public override void OnInspectorGUI() { StaticFilter targ = (StaticFilter)target; EditorGUILayout.Separator(); GUILayout.Label("Priority: " + targ.Priority); EditorGUILayout.Separator(); GUILayout.Box("Input Build Processor\n\n" + "Filters out all components that are NOT marked as static." , EditorUtil.HelpStyle , GUILayout.ExpandWidth(true)); EditorGUILayout.Separator(); }
public GraphingForm() { InitializeComponent(); tickTimer = new System.Timers.Timer(); tickTimer.Interval = 1000; tickTimer.Elapsed += OnTimedEvent; tickTimer.AutoReset = true; tickTimer.Enabled = false; aBar = null; mainFilter = new SinFilter(); // filter = new ScalingFilter(); // df = new ScalingDynamicFilter(); filter = new StaticWrapperFilter(mainFilter); UpdateForm(); }
public void AddPoints(StaticFilter f) { double step = 0.2; double[] xPoints = new double[(int)(((gPanel.GetMaxRange() - gPanel.GetMinRange()) / step) + 1)]; double[] yPoints; // Generate the input array for (int i = 0; i < xPoints.Length; i++) { xPoints[i] = i * step + gPanel.GetMinRange(); } // Generate the output array yPoints = f.ProcessFilter(xPoints); // Add all of the calculated points for (int i = 0; i < xPoints.Length; i++) { gPanel.AddDataPoint(new Point2D(xPoints[i], yPoints[i])); } }
private static void LoadOutFilter(IntPtr adapterHandle, List <TCPUDPConnection> list) { // Outgoing HTTP filter: REDIRECT OUT TCP packets with destination PORT 80 foreach (var line in list) { var ipAddressFilter = new IpAddressFilter( AddressFamily.InterNetwork, IpAddressFilter.IP_FILTER_FIELDS.IP_FILTER_DEST_ADDRESS | IpAddressFilter.IP_FILTER_FIELDS.IP_FILTER_SRC_ADDRESS, new IpNetRange(IpNetRange.ADDRESS_TYPE.IP_RANGE_TYPE, line.Local.Address, line.Local.Address), new IpNetRange(IpNetRange.ADDRESS_TYPE.IP_RANGE_TYPE, line.Remote.Address, line.Remote.Address), 6 ); var portFilter = new TcpUdpFilter( TcpUdpFilter.TCPUDP_FILTER_FIELDS.TCPUDP_DEST_PORT, new TcpUdpFilter.PortRange { startRange = (ushort)line.Local.Port, endRange = (ushort)line.Local.Port }, new TcpUdpFilter.PortRange { startRange = (ushort)line.Remote.Port, endRange = (ushort)line.Remote.Port }, 0); var filter = new StaticFilter( adapterHandle, PACKET_FLAG.PACKET_FLAG_ON_SEND, StaticFilter.FILTER_PACKET_ACTION.FILTER_PACKET_REDIRECT, StaticFilter.STATIC_FILTER_FIELDS.NETWORK_LAYER_VALID | StaticFilter.STATIC_FILTER_FIELDS.TRANSPORT_LAYER_VALID, null, ipAddressFilter, portFilter ); Console.WriteLine($"FILTER OUT Source:{line.Local.Address}:{line.Local.Port} Destination:{line.Remote.Address}:{line.Remote.Port}"); filterList.Add(filter); } }
public List <Tracklet> AnalyzeCCD(PipelineArguments Args) { Logger("Setting up pipeline"); /* Deal with incorrect SWARP flux scaling */ SWarpScaling.ApplyTransform = CorrectSWARP; string RunDir = Args.RunDir; if (!Directory.Exists(RunDir)) { Directory.CreateDirectory(RunDir); } /* Read input images and preprocess for poisson noise */ int ImageCount = Args.Inputs.Length; FitsImage[] FirstProcess = new FitsImage[ImageCount]; double[] PFW = PipelineHelperFunctions.LinearizedPoissonKernel(PoissonRadius); Step.StepPipeline sp = new Step.StepPipeline(StandardBITPIX, RunDir, Args.Inputs.Length, MaxDetections); sp.LogHookImage = LogImage; sp.LogHookDetection = LogDet; sp.LogMessage = LogMessage; bool HasBadpix = Args.Badpixel != null; Logger("Begining to run the pipeline"); var zpTask = System.Threading.Tasks.Task <Dictionary <IO.Image, double> > .Factory.StartNew(() => CalibrateZP(Args.Inputs)); var skTask = System.Threading.Tasks.Task <bool> .Factory.StartNew(() => PrecacheSkyBot(Args.Inputs)); BitArray[] map = PipelineHelperFunctions.ExtractBadpixel(Args.Badpixel, Logger); for (int i = 0; i < ImageCount; i++) { FitsImage Pipeline = Args.Inputs[i]; Pipeline.GetProperty <ImageSource>().AddToSet(Pipeline, "Original"); sp.SetModel(i, Pipeline, new List <IO.ImageProperties>() { Pipeline.GetProperty <ObservationTime>() }); if (!UseCoreFilter) { sp.RunPipeline(RestrictedMean.RestrictedMeanFilter, "Poisson", i, ref Pipeline, PFW, RestrictedMean.Parameters(PoissonRadius)); } else if (HasBadpix) { sp.RunPipeline(CoreFilter.Filter, "Poisson", i, ref Pipeline, new CoreFilter.CoreFilterParameters(PFW, map), CoreFilter.Parameters(PoissonRadius)); } else { throw new ArgumentException("Must specify Badpixel files if trying to run with CoreFilter"); } if (Operations.HasFlag(EnabledOperations.Normalization)) { if (!sp.EnsureImage("Normalized", i, out FitsImage Normalized)) { Point4Distance p4d = new Point4Distance(Pipeline, Normalized, NormalizationMeshSize); Logger("Generated Normalized image " + i); } else { Logger("Found Normalized image " + i); } Normalized.GetProperty <ImageSource>().AddToSet(Args.Inputs[i], "Normalized"); Pipeline = Normalized; } FirstProcess[i] = Pipeline; } /* Create the central median */ string CentralPath = Path.Combine(RunDir, "Central.fits"); if (!sp.EnsureCentralImage("Central", out FitsImage Central)) { HardMedians.MultiImageMedian.Run(null, FirstProcess, Central, HardMedians.MultiImageMedianParameters); Logger("Generated Central image"); } else { Logger("Found Central image"); } Logger("Computed the multi-image median"); /* Prepare the mask, slow object detector, trail detector, weights for second median filtering, etc. */ ImageStatistics CentralStats = new ImageStatistics(Central); if (Args.Clipped) { CentralStats = new ImageStatistics(Central, CentralStats.ZeroLevel, 2 * CentralStats.StDev); } StarData StarList = new StarData(); ComputeDetectorData(Central, CentralStats, StarList, out MaskByMedian.MaskProperties MaskProp, out DotDetector SlowDetector, out LongTrailDetector.LongTrailData LTD); if (Args.Clipped) { SlowDetector.HighThresholdMultiplier *= 2; SlowDetector.LowThresholdMultiplier *= 2; } DetectionReducer dr = new DetectionReducer() { PairingRadius = 0.7 }; if (Operations.HasFlag(EnabledOperations.SourceExtractor)) { try { dr.LoadStars(StarList.FixedStarList); } catch (Exception ex) { throw new ArgumentException("Could not read detections from SE catalog.", ex); } dr.GeneratePool(); } Logger("Set up detectors"); List <ImageDetection> FullDetectionsList = new List <ImageDetection>(); double[] FMW2 = PipelineHelperFunctions.LinearizedMedianKernel(); LTLimit ltl = new LTLimit() { MinPix = TrailMinPix }; RipFilter rf = new RipFilter() { SigmaTop = 30 }; Logger("Ready for final image processing and detection"); for (int i = 0; i < ImageCount; i++) { List <ImageDetection> LocalDetectionList = new List <ImageDetection>(); FitsImage DetectionSource = FirstProcess[i]; if (Operations.HasFlag(EnabledOperations.Masking)) { sp.RunPipeline(MaskByMedian.Masker, "Masked", i, ref DetectionSource, MaskProp, MaskByMedian.Parameters); } if (Operations.HasFlag(EnabledOperations.SecondMedian)) { sp.RunPipeline(HardMedians.WeightedMedian, "Second Median", i, ref DetectionSource, FMW2, HardMedians.WeightedMedianParameters(SecMedRadius)); } ImageStatistics SecMedStat = new ImageStatistics(DetectionSource); if (Operations.HasFlag(EnabledOperations.LongTrailDetector)) { var Dets = sp.RunDetector((FitsImage img) => { LongTrailDetector.PrepareAlgorithmForImage(img, SecMedStat, ref LTD); LongTrailDetector.Algorithm.Run(LTD, DetectionSource, LongTrailDetector.Parameters); return(LTD.Results); }, DetectionSource, "Trail", DetectionAlgorithm.Trail); LocalDetectionList.AddRange(Dets); } if (Operations.HasFlag(EnabledOperations.BlobDetector)) { var Dets = sp.RunDetector(SlowDetector.Detect, DetectionSource, "Blob", DetectionAlgorithm.Blob); LocalDetectionList.AddRange(Dets); } if (Operations.HasFlag(EnabledOperations.SourceExtractor)) { var dts = sp.RunDetector((arg) => { List <ImageDetection> Dets = ExtraIO.SourceExtractor.ParseSEFile(Args.CatalogData[i], Args.Inputs[i]); Dets = Dets.Where((x) => x.FetchProperty <ObjectPhotometry>().Flux > 300).ToList(); var ND = dr.Reduce(Dets); return(ND); }, DetectionSource, "SE", DetectionAlgorithm.SourceExtractor); LocalDetectionList.AddRange(dts); } if (Operations.HasFlag(EnabledOperations.OutputDetectionMap)) { DetectionDebugMap(RunDir, i, LocalDetectionList, DetectionSource); } rf.ImgMean = SecMedStat.ZeroLevel; rf.ImgSigma = SecMedStat.StDev; var NLDL = sp.RunFilters(LocalDetectionList, "LocalToGlobal", ltl, rf); Logger("Total " + NLDL.Count + " detections."); FullDetectionsList.AddRange(NLDL); } Logger("Filtering and pairing detections..."); LinearityThresholdFilter LTF = new LinearityThresholdFilter() { MaxLineThickness = MaxLineThickness }; List <ImageDetection> FilteredDetections = sp.RunFilters(FullDetectionsList, "MainFilter", LTF); StarList.MarkStarCrossed(FilteredDetections, StarCrossRadiusM, StarCrossMinFlux); if (Args.CCDBadzone != null) { FilteredDetections = sp.RunFilters(FilteredDetections, "Badzone", Args.CCDBadzone); } Logger("Before PrePair " + FilteredDetections.Count); PrePair.MatchDetections(FilteredDetections, MaxPairmatchDistance, MixMatch, SameArcSep); Logger("Left with " + FilteredDetections.Count + " detections"); LinePoolSimple lps = new LinePoolSimple() { MaxLinErrorArcSec = MaxResidual, SearchExtraSmall = SmallExtraSearchRadius, SearchExtraBig = BigExtraSearchRadius }; lps.LoadDetections(FilteredDetections); lps.GeneratePool(); var Pairings = lps.FindTracklets(); sp.NotePairings(FilteredDetections, Pairings); Logger("Found " + Pairings.Count + " raw tracklets"); LinearityTest lintest = new LinearityTest(); StaticFilter stf = new StaticFilter(); TotalError te = new TotalError(); var TK2List = sp.RunFilters(Pairings, "Tracklet Filtering", stf, te); Logger("After filtering: " + TK2List.Count + " candidate objects found"); sp.LogDetections(Path.Combine(RunDir, "detlog.txt")); Dictionary <IO.Image, double> ZP = zpTask.Result; skTask.Wait(); var Recovered = RecoverTracklets(TK2List, Args.Inputs, Path.Combine(RunDir, "reclog.txt"), ZP); TrackletsDeduplication.Deduplicate(Recovered, 1.0); Logger("Recovered " + Recovered.Count + " candidate objects"); PairSkyBot(Recovered, SkyBoTDistance, Args.FieldName, Args.CCDNumber, Args.Inputs, sp); return(Recovered); }