Esempio n. 1
0
        private BlockStoreDetectorResponse processDetectorQueryAverage(BlockStoreDetectorQuery query, int[] blockIDs)
        {
            BlockStoreDetectorResponse dr = new BlockStoreDetectorResponse();

            dr.Channels = new Dictionary <string, TOFChannel>();
            using (BlockDatabaseDataContext dc = new BlockDatabaseDataContext())
            {
                IEnumerable <DBTOFChannelSet> tcss = from DBTOFChannelSet tcs in dc.DBTOFChannelSets
                                                     where (tcs.detector == query.Detector) &&
                                                     blockIDs.Contains(tcs.blockID)
                                                     select tcs;
                // accumulate the average TCS
                TOFChannelSetAccumulator tcsa = new TOFChannelSetAccumulator();
                foreach (DBTOFChannelSet dbTcs in tcss)
                {
                    TOFChannelSet t = deserializeTCS(dbTcs.tcsData.ToArray());
                    tcsa.Add(t);
                }
                // TODO: Handle special channels
                TOFChannelSet averageTCS = tcsa.GetResult();
                foreach (string channel in query.Channels)
                {
                    dr.Channels.Add(channel, (TOFChannel)averageTCS.GetChannel(channel));
                }
            }
            return(dr);
        }
Esempio n. 2
0
        public ChannelSet <TOFWithError> TOFAccumulate(uint[] uids, string detector)
        {
            TOFChannelSetAccumulator tcsa = new TOFChannelSetAccumulator();

            for (uint i = 0; i < uids.Length; i++)
            {
                DemodulatedBlock db = (DemodulatedBlock)blockStore.GetDBlock(uids[i]);
                tcsa.Add((ChannelSet <TOFWithError>)db.GetTOFChannelSet(detector));
            }

            return(tcsa.GetResult());
        }
Esempio n. 3
0
 private BlockStoreDetectorResponse processDetectorQueryAverage(BlockStoreDetectorQuery query, int[] blockIDs)
 {
     BlockStoreDetectorResponse dr = new BlockStoreDetectorResponse();
     dr.Channels = new Dictionary<string, TOFChannel>();
     using (BlockDatabaseDataContext dc = new BlockDatabaseDataContext())
     {
         IEnumerable<DBTOFChannelSet> tcss = from DBTOFChannelSet tcs in dc.DBTOFChannelSets
                                             where (tcs.detector == query.Detector)
                                             && blockIDs.Contains(tcs.blockID)
                                             select tcs;
         // accumulate the average TCS
         TOFChannelSetAccumulator tcsa = new TOFChannelSetAccumulator();
         foreach (DBTOFChannelSet dbTcs in tcss)
         {
             TOFChannelSet t = deserializeTCS(dbTcs.tcsData.ToArray());
             tcsa.Add(t);
         }
         // TODO: Handle special channels
         TOFChannelSet averageTCS = tcsa.GetResult();
         foreach (string channel in query.Channels)
             dr.Channels.Add(channel, (TOFChannel)averageTCS.GetChannel(channel));
     }
     return dr;
 }