def test_03(self): """PresCfgXMLRead.test_03(): create a PRESCfgXML.PresCfgXMLRead() from "Resistivity_3Track_Logrithmic.xml" correct curves.""" myPcxr = PRESCfgXML.PresCfgXMLRead( self._fcxr, "Resistivity_3Track_Logrithmic.xml", ) self.assertEqual( sorted([ Mnem.Mnem(v, len_mnem=0) for v in [ 'PCAL', 'ILD', 'AHT60_8', 'MSFL', 'ILM', 'AHO90_9', 'ATR', 'AHF90_9', 'AHF30_7', 'A34H_ARC', 'AHT10_6', 'AHF60_8', 'RXO', 'AHT90_9', 'LLM', 'RLA1', 'AHT30_7', 'RLA3', 'RLA2', 'RLA5', 'RLA4', 'P34H_ARC', 'LLD', 'ROP5', 'A22H_ARC', 'AHO60_8', 'AHF20_5', 'BS_7', 'RLA0', 'AHO30_7', 'AHT20_5', 'P28H_ARC', 'SP_10', 'GR_9', 'AHO10_6', 'HiltCaliper', 'AHF10_6', 'TENS_6', 'SFL', 'P16H_ARC', 'AHO20_5', 'PSR', 'CALI_8', ] ]), sorted(myPcxr.keys()), ) self.assertTrue('BS_7' in myPcxr)
def test_02(self): """PresCfgXMLRead.test_02(): create a PRESCfgXML.PresCfgXMLRead() from "Resistivity_3Track_Logrithmic.xml" number of curves.""" myPcxr = PRESCfgXML.PresCfgXMLRead( self._fcxr, "Resistivity_3Track_Logrithmic.xml", ) # print('') # pprint.pprint(self._fcxr._chOutpMnemFilmMap) # print(myPcxr.keys()) self.assertEqual(43, len(myPcxr))
def _plotUsingLgFormats(self, theFi, theLpIdx, thePrs, theFpOut): """Plots a LogPass from a LIS file using the LgFormat XML files specify the plot. theFi - the LIS File object. theLpIdx - integer for the LogPass in the LIS File. thePrs - a PlotRecord Set that holds the seek positions of the appropriate LIS Logical Records (we only use CONS records here for the API header). theFpOut - Output file path for the SVG file(s), one per FILM ID. """ assert(len(self._lgFormatS) > 0) _p, myLogPass, myCONSRecS = self._retPlotFromPlotRecordSet(theFi, thePrs) myFilm = FILMCfgXML.FilmCfgXMLRead() for aUniqueId in self._lgFormatS: logging.info('PlotLogPasses._plotUsingLgFormats(): UniqueId={:s}.'.format(aUniqueId)) # Create a PRES like object from the UniqueId myRoot = myFilm.rootNode(aUniqueId) if myRoot is not None: myPres = PRESCfgXML.PresCfgXMLRead(myRoot, myFilm) myPlot = Plot.PlotReadXML(myFilm, myPres) if myPlot.hasDataToPlotLIS(myLogPass, aUniqueId): # Create output path and plot it myOutFilePath = '{:s}_{:04d}_{:s}.svg'.format(theFpOut, theLpIdx, aUniqueId) myCurvIDs, numPoints = myPlot.plotLogPassLIS( theFi, myLogPass, myLogPass.xAxisFirstEngVal, myLogPass.xAxisLastEngVal, aUniqueId, open(myOutFilePath, 'w'), frameStep=1, title="Plot: {:s} LogPass: {:d} FILM ID={:s}".format( os.path.abspath(myOutFilePath), theLpIdx, aUniqueId, ), lrCONS=myCONSRecS, ) assert(myCurvIDs is not None and numPoints is not None) # So here the essential data that we have to put in the index.html is: # Key: myOutFilePath or input file fp, lpIdx, aFilmId, # Value: (myPlot.xScale(aFilmId), myLogPass.xAxisFirstEngVal, myLogPass.xAxisLastEngVal, myCurvIDs) self.plotLogInfo.addPlotResult( theFi.fileId, myOutFilePath, theLpIdx, aUniqueId, myPlot.xScale(aUniqueId), myLogPass.xAxisFirstEngVal, myLogPass.xAxisLastEngVal, theCurveS=myCurvIDs, ptsPlotted=numPoints) else: logging.error('PlotLogPasses._plotUsingLgFormats(): No root node for UniqueId: "{:s}"'.format(aUniqueId)) else: logging.info('PlotLogPasses._plotUsingLgFormats(): No data to plot for FILM ID {:s}'.format(aUniqueId))
def test_06(self): """PresCfgXMLRead.test_06(): create a PRESCfgXML.PresCfgXMLRead() from "Resistivity_3Track_Logrithmic.xml" outputs for destination.""" myPcxr = PRESCfgXML.PresCfgXMLRead( self._fcxr, "Resistivity_3Track_Logrithmic.xml", ) self.assertTrue( myPcxr.usesOutpChannel("Resistivity_3Track_Logrithmic.xml", Mnem.Mnem('BS'))) self.assertFalse( myPcxr.usesOutpChannel("Resistivity_3Track_Logrithmic.xml", Mnem.Mnem('NOTBS'))) self.assertFalse( myPcxr.usesOutpChannel("Resistivity_3Track_Logrithmic.xml", 'BS'))
def fileCurveMapFromFILM(theLpOrLasFile, theFilmCfg): """Returns a map of ``{FilmID : [OUTP, ...], ...}`` which is a list of OUTP in theLpOrLasFile that could be plotted with that film ID.""" r = {} for uid in sorted(theFilmCfg.uniqueIdS()): myPresCfg = PRESCfgXML.PresCfgXMLRead(theFilmCfg, uid) try: myPhsFiCf = theFilmCfg[uid] outIdS = myPresCfg.outpChIDs(myPhsFiCf.name) except KeyError: pass else: r[uid] = [anO for anO in outIdS if theLpOrLasFile.hasOutpMnem(anO)] return r
def test_05(self): """PresCfgXMLRead.test_05(): create a PRESCfgXML.PresCfgXMLRead() from "Resistivity_3Track_Logrithmic.xml" outputs for destination.""" myPcxr = PRESCfgXML.PresCfgXMLRead( self._fcxr, "Resistivity_3Track_Logrithmic.xml", ) self.assertEqual( 1, len( myPcxr.outpCurveIDs("Resistivity_3Track_Logrithmic.xml", Mnem.Mnem('BS'))), ) self.assertEqual( [ 'BS_7', ], myPcxr.outpCurveIDs("Resistivity_3Track_Logrithmic.xml", Mnem.Mnem('BS')), )
def test_04(self): """PresCfgXMLRead.test_04(): create a PRESCfgXML.PresCfgXMLRead() from "Resistivity_3Track_Logrithmic.xml" outputs for destination.""" myPcxr = PRESCfgXML.PresCfgXMLRead( self._fcxr, "Resistivity_3Track_Logrithmic.xml", ) self.assertTrue( myPcxr.hasCurvesForDest("Resistivity_3Track_Logrithmic.xml")) # print() # print(sorted(myPcxr.outpChIDs("Resistivity_3Track_Logrithmic.xml"))) # pprint.pprint(sorted(myPcxr.outpChIDs("Resistivity_3Track_Logrithmic.xml"))) self.assertEqual( 43, len(myPcxr.outpChIDs("Resistivity_3Track_Logrithmic.xml"))) exp = [ Mnem.Mnem(m) for m in [ 'A22H', 'A34H', 'AHF10', 'AHF20', 'AHF30', 'AHF60', 'AHF90', 'AHO10', 'AHO20', 'AHO30', 'AHO60', 'AHO90', 'AHT10', 'AHT20', 'AHT30', 'AHT60', 'AHT90', 'ATR', 'BS', 'CALI', 'GR', 'HCAL', 'ILD', 'ILM', 'LLD', 'LLM', 'MSFL', 'P16H_RT', 'P28H_RT', 'P34H_RT', 'PCAL', 'PSR', 'RLA0', 'RLA1', 'RLA2', 'RLA3', 'RLA4', 'RLA5', 'ROP5', 'RXO', 'SFL', 'SP', 'TENS', ] ] act = sorted([ str(v) for v in myPcxr.outpChIDs("Resistivity_3Track_Logrithmic.xml") ]) self.assertEqual(exp, act)
def test_01(self): """PresCfgXMLRead.test_01(): create a PRESCfgXML.PresCfgXMLRead() from "Resistivity_3Track_Logrithmic.xml".""" PRESCfgXML.PresCfgXMLRead( self._fcxr, "Resistivity_3Track_Logrithmic.xml", )