MCPcopy Create free account
hub / github.com/DeepLabCut/DeepLabCut / create_new_project_3d

Function create_new_project_3d

deeplabcut/create_project/new_3d.py:19–134  ·  view source on GitHub ↗

r"""Creates a new project directory, sub-directories and a basic configuration file for 3d project. The configuration file is loaded with the default values. Adjust the parameters to your project's needs. Parameters ---------- project : string String containing the name

(project, experimenter, num_cameras=2, working_directory=None)

Source from the content-addressed store, hash-verified

17
18
19def create_new_project_3d(project, experimenter, num_cameras=2, working_directory=None):
20 r"""Creates a new project directory, sub-directories and a basic configuration file
21 for 3d project. The configuration file is loaded with the default values. Adjust the
22 parameters to your project's needs.
23
24 Parameters
25 ----------
26 project : string
27 String containing the name of the project.
28
29 experimenter : string
30 String containing the name of the experimenter.
31
32 num_cameras : int
33 An integer value specifying the number of cameras.
34
35 working_directory : string, optional
36 The directory where the project will be created. The default is the ``current working directory``; if provided,
37 it must be a string.
38
39
40 Example
41 --------
42 Linux/MacOs
43 >>> deeplabcut.create_new_project_3d('reaching-task','Linus',2)
44
45 Windows:
46 >>> deeplabcut.create_new_project('reaching-task','Bill',2)
47 Users must format paths with either: r'C:\ OR 'C:\\ <- i.e. a double backslash \\ )
48 """
49 from datetime import datetime as dt
50
51 from deeplabcut.utils import auxiliaryfunctions
52
53 date = dt.today()
54 month = date.strftime("%B")
55 day = date.day
56 d = str(month[0:3] + str(day))
57 date = dt.today().strftime("%Y-%m-%d")
58
59 if working_directory is None:
60 working_directory = "."
61
62 wd = Path(working_directory).resolve()
63 project_name = "{pn}-{exp}-{date}-{triangulate}".format(pn=project, exp=experimenter, date=date, triangulate="3d")
64 project_path = wd / project_name
65 # Create project and sub-directories
66 if not DEBUG and project_path.exists():
67 print(f'Project "{project_path}" already exists!')
68 return
69
70 camera_matrix_path = project_path / "camera_matrix"
71 calibration_images_path = project_path / "calibration_images"
72 undistortion_path = project_path / "undistortion"
73 path_corners = project_path / "corners"
74 path_removed_images = project_path / "removed_calibration_images"
75
76 for p in [

Callers 1

finalize_projectMethod · 0.90

Calls 2

formatMethod · 0.80
insertMethod · 0.80

Tested by

no test coverage detected