This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lsst.rsp import get_tap_service | |
from IPython.display import display, HTML | |
def print_test(msg, color="black"): | |
display(HTML(f'<span style="color: {color}">{msg}</span>')) | |
def print_error(msg, object_name, exception): | |
display(HTML(f'<span style="color: red; font-weight: bold;">Error {msg}: {object_name}</span>')) | |
display(HTML(f'<span style="color: red;">{exception}</span>')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Example of using Great Expectations to validate ci_imsim test | |
data. | |
""" | |
import lsst.daf.butler as dafButler | |
import great_expectations as gx | |
from great_expectations.data_context import DataContext | |
from great_expectations.core.batch import BatchRequest | |
# Get the test data frame from the Butler |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Tech Advancing] [Information] Flushing old Research Manager values. | |
UnityEngine.StackTraceUtility:ExtractStackTrace () | |
Verse.Log:Message (string) | |
TechAdvancing.LogOutput:WriteLogMessage (TechAdvancing.Errorlevel,string) | |
TechAdvancing.TA_ResearchManager:FlushCfg () | |
TechAdvancing.WorldCompSaveHandler:ExposeData () | |
Verse.ScribeExtractor:SaveableFromNode<RimWorld.Planet.WorldComponent> (System.Xml.XmlNode,object[]) | |
Verse.Scribe_Collections:Look<RimWorld.Planet.WorldComponent> (System.Collections.Generic.List`1<RimWorld.Planet.WorldComponent>&,bool,string,Verse.LookMode,object[]) | |
Verse.Scribe_Collections:Look<RimWorld.Planet.WorldComponent> (System.Collections.Generic.List`1<RimWorld.Planet.WorldComponent>&,string,Verse.LookMode,object[]) | |
RimWorld.Planet.World:ExposeComponents () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# snippet: not all code included | |
# revised loop to do cross-validation | |
for (m in 1:length(allModels)) { | |
allpredicted = rep(NA,n) # storage for honest predictions | |
for (ii in 1: nfolds) { # ii is an easier string to search for index | |
groupii = (cvgroups == ii) | |
trainset = bodyfat[!groupii,] # all data EXCEPT for group ii | |
testset = bodyfat[groupii, ] # data in group ii |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = read.csv("mydata.csv") | |
n = nrow(data) | |
nfolds = 5 # 5-fold CV | |
groups = rep(1:nfolds, length=n) | |
set.seed(2) | |
cvgroups = sample(groups, n) | |
allpredicted = rep(NA, n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Connect to an MS SQL Server and execute a query | |
""" | |
import pyodbc | |
conn = pyodbc.connect('Driver={SQL Server};' | |
'Server=THINKSGIVING\SQL;' | |
'Database=AdventureWorks2017;' | |
'Trusted_Connection=yes;') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for f in $(find src/ include/ hps_eve.cxx -type f); do r=$(cat $f | awk 'NF' | wc -l); echo $f:$r; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auto vec = step->GetPreStepPoint()->GetPosition(); | |
const double pos[] = {vec[0], vec[1], vec[2]}; | |
double bfield[] = {0, 0, 0, 0}; | |
G4StepPoint* pre = step->GetPreStepPoint(); | |
G4FieldManager* globalFieldMgr = G4TransportationManager::GetTransportationManager()-> GetFieldManager(); | |
globalFieldMgr->GetDetectorField()->GetFieldValue(pos, bfield); | |
std::cout << ">>>> Field val: " << pre->GetPosition() << " -> (" | |
<< bfield[0] << ", " << bfield[1] << ", " << bfield[2] << ") " << std::endl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <iostream> | |
#include "TEveManager.h" | |
#include "TEveBrowser.h" | |
#include "TEveGeoNode.h" | |
#include "TEveScene.h" | |
#include "TEveViewer.h" | |
#include "TGLViewer.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
void MakeGeometry() { | |
TGeoManager *geom = new TGeoManager ("simple1", "Simple geometry"); | |
//--- define some materials | |
TGeoMaterial *matVacuum = new TGeoMaterial ("Vacuum", 0, 0, 0); | |
TGeoMaterial *matAl = new TGeoMaterial ("Al", 26.98, 13, 2.7); | |
//--- define some media | |
TGeoMedium *Vacuum = new TGeoMedium ("Vacuum", 1, matVacuum); |
NewerOlder