cylindra.project
CylindraBatchProject
A project of cylindra batch processing.
Source code in cylindra/project/_batch.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
resolve_path(file_dir)
Resolve the path of the project.
Source code in cylindra/project/_batch.py
57 58 59 60 61 |
|
save_gui(gui, project_dir, mole_ext='.csv')
classmethod
Save the GUI state to a project directory.
Source code in cylindra/project/_batch.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|
CylindraProject
A project of cylindra.
Source code in cylindra/project/_single.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 |
|
from_gui(gui, project_dir, mole_ext='.csv', save_landscape=False)
classmethod
Construct a project from a widget state.
Source code in cylindra/project/_single.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
iter_load_molecules(dir=None)
Load all molecules iteratively.
Source code in cylindra/project/_single.py
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
|
iter_load_splines(dir=None, drop_columns=True)
Load all splines including its properties iteratively.
Source code in cylindra/project/_single.py
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
|
iter_spline_paths(dir=None)
Iterate over the paths of splines and their indices.
Source code in cylindra/project/_single.py
324 325 326 327 328 329 330 331 332 333 334 335 336 |
|
load_molecules(name, dir=None)
Load the molecule with the given name.
mole = project.load_molecules("Mole-0") # load one with name "Mole-0"
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Name of the molecules layer. |
required |
dir |
Path
|
The project directory. Can be given if the project is already opened. |
None
|
Returns:
Type | Description |
---|---|
Molecules
|
The molecules instance that matches the given name. |
Source code in cylindra/project/_single.py
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
|
load_spline(idx, dir=None, props=True)
Load the spline of the given index.
spl = project.load_spline(0) # load the 0-th spline instance
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx |
int
|
The index of the spline. |
required |
dir |
Path
|
The project directory. Can be given if the project is already opened. |
None
|
props |
bool
|
Whether to load the properties of the spline. |
True
|
Returns:
Type | Description |
---|---|
CylSpline
|
The spline instance. |
Source code in cylindra/project/_single.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
|
load_tomogram(dir=None, compute=True)
Load the tomogram object of the project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dir |
Path
|
Can be given if the project is already opened. |
None
|
compute |
bool
|
Whether to compute the binned tomograms. |
True
|
Source code in cylindra/project/_single.py
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
|
make_project_viewer()
Build a project viewer widget from this project.
Source code in cylindra/project/_single.py
515 516 517 518 519 520 521 |
|
new(image, scale, multiscales, missing_wedge=None, project_path=None)
classmethod
Create a new project.
Source code in cylindra/project/_single.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
open_project()
Open the project within this context.
Source code in cylindra/project/_single.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 |
|
resolve_path(file_dir)
Resolve the path of the project.
Source code in cylindra/project/_single.py
46 47 48 49 50 |
|
rewrite(dir)
Rewrite tar/zip file using given temporary directory.
This method is only used after some mutable operation on the project directory.
Source code in cylindra/project/_single.py
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 |
|
save(project_dir, molecules={})
Save this project.
Source code in cylindra/project/_single.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
save_gui(gui, project_dir, mole_ext='.csv', save_landscape=False)
classmethod
Serialize the GUI state to a json file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gui |
CylindraMainWidget
|
The main widget from which project model will be constructed. |
required |
project_dir |
Path
|
The path to the project json file. |
required |
Source code in cylindra/project/_single.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
|
ProjectSequence
Collection of Cylindra projects.
This object is just for project management. BatchLoader, DataFrame and local/global properties can be generated from this object.
Source code in cylindra/project/_sequence.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 |
|
__add__(other)
Concatenate two ProjectSequence objects.
Source code in cylindra/project/_sequence.py
138 139 140 141 142 143 144 145 146 147 148 |
|
append_file(path)
Add a project from a file path.
Source code in cylindra/project/_sequence.py
169 170 171 172 173 174 |
|
collect_globalprops(allow_none=True, suffix='', id='int')
Collect all globalprops into a single dataframe.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
allow_none |
bool
|
Continue data collection even if property table data file was not found in any project. Raise error otherwise. |
True
|
suffix |
str
|
Suffix to add to the column names that may be collide with the local properties. |
""
|
id |
str
|
How to describe the source tomogram. If "int", each tomogram will be labeled with ascending integers. If "path", each tomogram will be labeled with the name of the project directory. |
"int"
|
Returns:
Type | Description |
---|---|
DataFrame
|
Dataframe with all the properties. |
Source code in cylindra/project/_sequence.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
|
collect_joinedprops(allow_none=True, id='int', spline_details=False)
Collect all the local and global properties into a single dataframe.
The global properties are suffixed with "_glob". Note that these columns will repeat the same values for each spline. For instance, the "spacing" columns will look like following.
col.collect_joinedprops().select(["spacing", "spacing_glob"])
shape: (12, 2)
┌───────────┬──────────────┐
│ spacing ┆ spacing_glob │
│ --- ┆ --- │
│ f32 ┆ f32 │
╞═══════════╪══════════════╡
│ 4.093385 ┆ 4.1024575 │
│ 4.0987015 ┆ 4.1024575 │
│ 4.1013646 ┆ 4.1024575 │
│ … ┆ … │
│ 4.074887 ┆ 4.089436 │
│ 4.0987015 ┆ 4.089436 │
└───────────┴──────────────┘
Parameters:
Name | Type | Description | Default |
---|---|---|---|
allow_none |
bool
|
Forwarded to |
True
|
id |
str
|
How to describe the source tomogram. If "int", each tomogram will be labeled with ascending integers. If "path", each tomogram will be labeled with the name of the project directory. |
"int"
|
spline_details |
bool
|
Forwarded to |
False
|
Returns:
Type | Description |
---|---|
DataFrame
|
Dataframe with all the properties. |
Source code in cylindra/project/_sequence.py
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
|
collect_localprops(allow_none=True, id='int', spline_details=False)
Collect all localprops into a single dataframe.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
allow_none |
bool
|
Continue data collection even if property table data file was not found in any project. Raise error otherwise. |
True
|
id |
str
|
How to describe the source tomogram. If "int", each tomogram will be labeled with ascending integers. If "path", each tomogram will be labeled with the name of the project directory. |
"int"
|
spline_details |
bool
|
If True, spline coordinates, its derivatives and the curvature will also be collected as well. This will take more memory and time. |
False
|
Returns:
Type | Description |
---|---|
DataFrame
|
Dataframe with all the properties. |
Source code in cylindra/project/_sequence.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
|
collect_molecules(name_filter=None, *, curvature=False)
Collect all the molecules in this project sequence.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name_filter |
callable
|
Function that takes a molecule file name (without extension) and returns True if the molecule should be collected. Collect all the molecules by default. |
None
|
curvature |
bool
|
If True, the spline curvature will be added to the molecule features. |
False
|
Source code in cylindra/project/_sequence.py
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
|
collect_props(allow_none=True, spline_details=False, suffix='')
Collect all the local and global properties.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
allow_none |
bool
|
Forwarded to |
True
|
spline_details |
bool
|
Forwarded to |
False
|
Returns:
Type | Description |
---|---|
CollectedProps
|
Tuple of the collected local and global properties. |
Source code in cylindra/project/_sequence.py
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
|
collect_spline_coords(ders=0)
Collect spline coordinates or its derivative(s) as a dataframe.
Coordinates will be labeled as "z", "y", "x". The 1st derivative will be labeled as "dz", "dy", "dx", and so on.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ders |
int or iterable of int
|
Derivative order(s) to collect. If multiple values are given, all the derivatives will be concatenated in a single dataframe. |
0
|
Source code in cylindra/project/_sequence.py
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 |
|
from_paths(paths, *, check_scale=True, skip_exc=False)
classmethod
Add all the projects of the given paths.
Source code in cylindra/project/_sequence.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
insert(index, value)
Insert a project at the given index.
Source code in cylindra/project/_sequence.py
132 133 134 135 136 |
|
iter_molecules(name_filter=None)
Iterate over all the molecules in all the projects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name_filter |
callable
|
Function that takes a molecule file name (without extension) and returns True if the molecule should be collected. Collect all the molecules by default. |
None
|
Source code in cylindra/project/_sequence.py
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 |
|
iter_molecules_with_splines(name_filter=None, *, skip_no_spline=True)
Iterate over all the molecules and its source spline.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name_filter |
callable
|
Function that takes a molecule file name (without extension) and returns True if the molecule should be collected. Collect all the molecules by default. |
None
|
skip_no_spline |
bool
|
If True, molecules without a source spline will be skipped. |
True
|
Source code in cylindra/project/_sequence.py
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 |
|
iter_splines()
Iterate over all the splines in all the projects.
Source code in cylindra/project/_sequence.py
464 465 466 467 468 469 |
|
sta_loader(name_filter=None, *, curvature=False, allow_no_image=False)
Construct a STA loader from all the projects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name_filter |
callable
|
Function that takes a molecule file name (without extension) and returns True if the molecule should be collected. Collect all the molecules by default. |
None
|
curvature |
bool
|
If True, the spline curvature will be added to the molecule features. |
False
|
allow_no_image |
bool
|
If True, this method will not raise an error when the image file is not found. |
False
|
Source code in cylindra/project/_sequence.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
|
extract(text)
Extract the content of main function.
Source code in cylindra/project/_utils.py
27 28 29 30 31 32 33 34 35 36 37 |
|
get_project_file(path)
Return the path to the project file.
Source code in cylindra/project/_utils.py
40 41 42 43 44 45 46 47 48 49 50 |
|