ifsys.version_info.major==3andsys.version_info.minor==10:print("Python version is 3.10")else:print(f"Python version is not 3.10, it's {sys.version_info.major}.{sys.version_info.minor}")
Numbers
Not a number float('nan'). This is often seen in 0/0
In numpy, this is np.nan. To check, it’s numpy.isnan()
Print Options
Multiline Printing
1
2
3
4
print(f'''
line 1
line2
''')
Print float with 2 decimal digits
1
print(f"{test_acc:.2f}%")
Argparse
Adding a required arg:
1
parser.add_argument("--name","-n",type=str,required=True,help="Name of a bag in rgbd_slam_rico/data")
Can handle many different datatypes in multiple data blocks, with metadata
We can access them in data blocks
numpy array holds the data, and directly to and from the data.
used as ML model weights
To use HDF5, numpy needs to be imported.
Formatting
isort will reorder this. But you can turn off the formatting for now so path is properly added
1
2
3
4
# fmt: off
sys.path.insert(0,os.path.join(os.path.dirname(os.path.abspath(__file__)),"..","models","Chamfer3D"))fromdist_chamfer_3Dimportchamfer_3DDist,chamfer_3DFunction# fmt: on