Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/Detray/tests/tools/python/options/display_options.py was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 # This file is part of the ACTS project.
0002 #
0003 # Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 #
0005 # This Source Code Form is subject to the terms of the Mozilla Public
0006 # License, v. 2.0. If a copy of the MPL was not distributed with this
0007 # file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 import argparse
0010 import os
0011 
0012 # ------------------------------------------------------------------------------
0013 # Options parsing
0014 # ------------------------------------------------------------------------------
0015 
0016 
0017 def display_options():
0018     """Parent parser that contains the detector display options."""
0019 
0020     parser = argparse.ArgumentParser(add_help=False)
0021 
0022     parser.add_argument(
0023         "--outdir",
0024         "-o",
0025         help=("Output directory for the svg files"),
0026         default="./plots/",
0027         type=str,
0028     )
0029     parser.add_argument(
0030         "--context", help=("Number of the geometry context"), default=0, type=int
0031     )
0032     parser.add_argument(
0033         "--r_axis", help=("Length of the radial axis [mm]"), default=1100.0, type=float
0034     )
0035     parser.add_argument(
0036         "--x_axis", help=("Length of the x axis [mm]"), default=None, type=float
0037     )
0038     parser.add_argument(
0039         "--y_axis", help=("Length of the y axis [mm]"), default=None, type=float
0040     )
0041     parser.add_argument(
0042         "--z_axis", help=("Length of the z axis [mm]"), default=3100.0, type=float
0043     )
0044     parser.add_argument("--font_size", help=("Font size"), default=35, type=int)
0045     parser.add_argument(
0046         "--search_window",
0047         help=("Size of the grid surface search window"),
0048         nargs=2,
0049         default=[1, 1],
0050         type=int,
0051     )
0052     parser.add_argument(
0053         "--volume_indices",
0054         help=("List of volumes that should be displayed by index"),
0055         nargs="+",
0056         default=[],
0057         type=int,
0058     )
0059     parser.add_argument(
0060         "--volume_names",
0061         help=("List of volumes that should be displayed by name"),
0062         nargs="+",
0063         default=[],
0064         type=str,
0065     )
0066     parser.add_argument(
0067         "--surfaces",
0068         help=("List of surfaces that should be displayed"),
0069         nargs="+",
0070         default=[],
0071         type=int,
0072     )
0073     parser.add_argument(
0074         "--hide_portals", help=("Hide portal surfaces"), action="store_true"
0075     )
0076     parser.add_argument(
0077         "--hide_passives", help=("Hide passive surfaces"), action="store_true"
0078     )
0079     parser.add_argument(
0080         "--hide_material", help=("Don't draw surface material"), action="store_true"
0081     )
0082     parser.add_argument(
0083         "--hide_eta_lines", help=("Hide eta lines"), action="store_true"
0084     )
0085     parser.add_argument("--show_info", help=("Show info boxes"), action="store_true")
0086     parser.add_argument(
0087         "--write_volume_graph",
0088         help=("Writes the volume graph to file"),
0089         action="store_true",
0090     )
0091 
0092     return parser
0093 
0094 
0095 def parse_display_options(args, logging):
0096     """Parse the detector display options from the commandline."""
0097 
0098     # The axes default to the radial axis, but the gradient box is aligned with
0099     # the axis that was given explicitly
0100     if args.x_axis is None:
0101         args.x_axis = args.r_axis
0102         args.material_gradient_axis = args.z_axis
0103     else:
0104         args.material_gradient_axis = args.x_axis
0105 
0106     if args.y_axis is None:
0107         args.y_axis = args.r_axis
0108 
0109     # Create the output path
0110     os.makedirs(args.outdir, mode=0o755, exist_ok=True)
0111 
0112     return args.outdir