![]() |
ATLAS Offline Software
|
Functions | |
def | load_json (file_path="Geometry.json") |
def | find (bec=None, layer_disk=None, phi=None, eta=None, side=None, asdec=False, input_data="Geometry.json", output_file="Geometry_find.json") |
def | merge (file_1="Geometry_1.json", file_2="Geometry_2.json", output_file="Geometry_merge.json") |
def | select_random (frac=0, input_data="Geometry.json", output_file="Geometry_rand.json", seed=None) |
def | generate_uncorr (fractions=[], input_data="Geometry.json", prefix="Geometry_rand", output_dir=None, seed=None) |
def | generate_corr (fractions=[], input_data="geometry.json", prefix="Geometry_rand", output_dir=None, seed=None) |
def | difference (file_1="Geometry_1.json", file_2="Geometry_2.json", output_file="Geometry_diff.json") |
def | frac_convertor (frac=None, file_1="Geometry.json", file_2="Selected_geometry.json", file_3="Not_selected_yet.json") |
Variables | |
current_dir = os.path.dirname(os.path.abspath(__file__)) | |
def | data = find(bec = 0, layer_disk = 0, phi = None, eta = None, side = None, asdec = False, input_data = "PixelGeometry.json", output_file = "IBL_modules.json") |
def module_selector_from_json.difference | ( | file_1 = "Geometry_1.json" , |
|
file_2 = "Geometry_2.json" , |
|||
output_file = "Geometry_diff.json" |
|||
) |
Function to perform the differnence between two json files produces with different configuration
Definition at line 195 of file module_selector_from_json.py.
def module_selector_from_json.find | ( | bec = None , |
|
layer_disk = None , |
|||
phi = None , |
|||
eta = None , |
|||
side = None , |
|||
asdec = False , |
|||
input_data = "Geometry.json" , |
|||
output_file = "Geometry_find.json" |
|||
) |
this can look for specific set of modules based on parameters: bec(barrel or end cap), layer_disk, phi, eta and side.
Definition at line 28 of file module_selector_from_json.py.
def module_selector_from_json.frac_convertor | ( | frac = None , |
|
file_1 = "Geometry.json" , |
|||
file_2 = "Selected_geometry.json" , |
|||
file_3 = "Not_selected_yet.json" |
|||
) |
Function used in the generate_corr() function to compute the new fraction of module to select. Since the input_data file in select_random() contains less and less modules as one selects them, the fraction of module to be selected has to be recompute to match the desired one. Exemple : In file A, there are 100 modules. One wants to create two correlated files : - file B : 10% of modules ( size = 10 modules ) - file C : 50% of modules ( size = 50 modules = 10 modules from file A + 40 new modules ) For file C, one can not use 0.5 as a fraction because it would select 45 modules and file C would contains 55 modules instead of 50, as desired: # of selected modules = len(file A - file B) * frac = (100 - 10) * 0.5 = 45 So, 45 + 10 = 55 ! The new fraction should be: new_frac = [ (number of wanted modules in final file) - (number of already selected modules) ] / (number of not yet selected modules) = [ (len(file A) * frac) - len(file B) ] / (len(file A - file B)) = [ 50 - 10 ] / 90 = 4/9 ~ 0.4445 So the file C contains : # of selected modules = len(file A - file B) * new_frac = (100 - 10) * 4/9 = 40 So, 40 + 10 = 50 !
Definition at line 213 of file module_selector_from_json.py.
def module_selector_from_json.generate_corr | ( | fractions = [] , |
|
input_data = "geometry.json" , |
|||
prefix = "Geometry_rand" , |
|||
output_dir = None , |
|||
seed = None |
|||
) |
Generate correlated files using a random selection for each fractions, but modules that have been selected are kept in the next files and removed from the input_data file. Exemple : Running : generate_corr(fraction=[1,5], input_data = "PixelGeometry.json", prefix = "PixelGeometry" output_dir = "path/to/dir") will create 3 files : - PixelGeometry_1pct_corr.json : Contains 1% of modules from PixelGeometry.json file - PixelGeometry_5pct_corr.json : Contains all selected modules in the 1% file + additional Pixel modules to get to a total of 5% module w.r.t to the input file, PixelGeometry.json - PixelGeometry_not_selected.json : Contains all modules that have not been randomly selected.
Definition at line 143 of file module_selector_from_json.py.
def module_selector_from_json.generate_uncorr | ( | fractions = [] , |
|
input_data = "Geometry.json" , |
|||
prefix = "Geometry_rand" , |
|||
output_dir = None , |
|||
seed = None |
|||
) |
Function to generate uncorrelated files. Each file contains randomly selected modules according to the values in fractions. Exemple : Running : generate_uncorr(fraction=[1,5], input_data = "PixelGeometry.json", prefix = "PixelGeometry" output_dir = "path/to/dir") will create 2 files: - PixelGeometry_1pct_corr.json : Contains 1% of modules from PixelGeometry.json file. - PixelGeometry_5pct_corr.json : Contains 5% of modules from PixelGeometry.json file (Some module can be in the first file but not the second one and vis versa.)
Definition at line 118 of file module_selector_from_json.py.
def module_selector_from_json.load_json | ( | file_path = "Geometry.json" | ) |
Function to load properly module informations from an input json file.
Definition at line 11 of file module_selector_from_json.py.
def module_selector_from_json.merge | ( | file_1 = "Geometry_1.json" , |
|
file_2 = "Geometry_2.json" , |
|||
output_file = "Geometry_merge.json" |
|||
) |
Function to merge any two json files produced with different configuration.
Definition at line 64 of file module_selector_from_json.py.
def module_selector_from_json.select_random | ( | frac = 0 , |
|
input_data = "Geometry.json" , |
|||
output_file = "Geometry_rand.json" , |
|||
seed = None |
|||
) |
Function to select a given fraction of modules randomly from all the modules using Geometry.json as input. The seed can be change.
Definition at line 88 of file module_selector_from_json.py.
module_selector_from_json.current_dir = os.path.dirname(os.path.abspath(__file__)) |
Definition at line 258 of file module_selector_from_json.py.
def module_selector_from_json.data = find(bec = 0, layer_disk = 0, phi = None, eta = None, side = None, asdec = False, input_data = "PixelGeometry.json", output_file = "IBL_modules.json") |
Definition at line 264 of file module_selector_from_json.py.