Skip to main content

Dowling's integrated data analysis for DQ experiemnt setup. Include data analysis functions, csv saving tools, Particle ID model, DNN model frame for ID training and EMCal ploting tools

Project description

dwong, a package for DarkQuest data analysis.

dwong is a comprehensive Python package, created by student Dowling Wong, tailored for data analysis and neural network-based particle identification in the DarkQuest experiment. The aim of this project is to streamline DarkQuest's data analysis process by providing exemplary data-processing functions.

The package mainly contains four modules: dwong, dplot, dcsv and dkeras.

Contents and useful functions.

  • dwong
    • emcal_bytuple
    • multi_clusters
    • h4_bytuple
    • prepare_data_bytuple
  • dplot
    • emcal_evt(x, y, eng)
    • emcal_pdf(ntuple_name, fname, absolute_path)
  • dkeras
    • train_model(x, y)
    • save_model(model, fname)
    • load_model(mname)
    • plot_confusion_matrix(cm, names, title='Confusion matrix', cmap=plt.cm.Blues)
    • plot_roc(pred,y)
  • dcsv
    • gen_csv(filename)

scheme

Smaple of use.

dwong, main module for data analysis.

 import dwong
 
 dq_events = dwong.getData(filename, "Events") #data acquisition from n-tuple.
 (x, y, eng, labels, labels_decrease, seeds, seed_labels) = dwong.multi_clusters(dq_events)#here performed clustering
 (h4x, h4y) = h4_bytuple(dq_events)
 dq_st23 = dq_events["st23"]
 dq_track = dq_events["track"]
 gpz = dq_events["gen"]["pz"]
 trkls_coord = np.stack((dq_st23["x"], dq_st23["y"], dq_st23["z"], dq_st23["px"], dq_st23["py"], dq_st23["pz"]), axis=1)
 trkls_cal = np.stack((dq_st23["Cal_x"], dq_st23["Cal_y"]), axis=1)
 track_st3 = np.stack((dq_track["x"], dq_track["y"], dq_track["pz"]), axis=1)

 folded_list=dwong.prepare_data_bytuple(filename)#return a list of events, each event may contain multiple particles.   
 flat_list = [particle for event in folded_list for particle in event]
 labels = [0] * len(flat_list)
 labeled_flat_list = [[label, *particle] for label, particle in zip(labels, flat_list)]#list of particles, in a flat list.

dplot, plot module.

 import dwong
 from dwong import dplot

 dq_events = dwong.getData(filename, "Events") #data acquisition from n-tuple.
 (x, y, eng) = emcal_bytuple(dq_events)
 fig = emcal_evt(x, y, eng)
 #The emcal_evt will plot the emcal page in jupyter notebook, and if you have further consideration, it returns fig

 #save a pdf booklet for all the emcal plots for events in a root file
 if ntuple_name.endswith(".root")& (ntuple_name not in train):
        emcal_pdf(ntuple_name, fname, absolute_path)

 #or you can plot all n-tuple under a directory
 target_dir = os.listdir("/Users/dwong/Desktop/n-tuples/5_80_training/")
 for file_name in target_dir:
     os.chdir(taregt_dir)
     if file_name.endswith(".root")& (file_name not in train):
         emcal_pdf(ntuple_name, fname, absolute_path)
 

External Link

*DarkQuest Snowmass paper. *DarkQuest Collaboration code collection. *The source for this project is available here. *Dowling's code collection for data analysis, model training, particle ID and samples. *Analysis package dwong's Pypi page. *Dowling's personal website.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dwong-0.2.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dwong-0.2-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file dwong-0.2.tar.gz.

File metadata

  • Download URL: dwong-0.2.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for dwong-0.2.tar.gz
Algorithm Hash digest
SHA256 fed72237752292e962a169b49e3c9c646b4e38f8035dc20a7c2709a14ac8cc7c
MD5 4cd3ff2c1112f6c165bf11e5e115e4b5
BLAKE2b-256 479db29f14feef2d55a66322a284f91c8931a8881a9439ab5645a39990e103da

See more details on using hashes here.

File details

Details for the file dwong-0.2-py3-none-any.whl.

File metadata

  • Download URL: dwong-0.2-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for dwong-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c18d56d2b6253eeb99f864da2580748f5039ba585d0e7f78ac3815b5c6e0acdb
MD5 24906184bd3b567afcddfd23434fc37c
BLAKE2b-256 20f90a105332cf30c176758c2738d20c67030ffdd25985b0c2ab22c70c3580c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page