Skip to content

ImageSource.save() desired behavior #745

@chris-langfield

Description

@chris-langfield

What should be the default and optional behaviors for the save() method?

save() calls two functions (which are currently public): save_metadata() and save_images().

Some cases we might want to cover:

  • Apply transformations, save to a new starfile and new (modified) .mrcs.

  • Save just a new starfile, which references the same .mrcs data. For example, representing a subset of the data

  • Save only new .mrcs data while keeping the same starfile? (I don't think this would / should be done because of the possibility that metadata, e.g. CTF params, will be different after certain transformations are applied)

  • Should save() require a new filename, and should the same stem be used for the saved mrcs or should that be configurable

A sketch of possible behavior (no overwrite of original starfile allowed unless the file is physically removed)

src = Source(starfile_path, max_rows = 1000)
src.save("mysource_n1000.star")  # just save truncated but identical metadata, referencing the same `.mrcs` files

src.save(starfile_path) # error: overwriting original metadata file

src.downsample(64)
src.save(starfile_path) # error: overwriting original metadata file

os.rm(starfile_path)
src.save(starfile_path) # saves the starfile, but does not write any new data (downsample is lost). references same `mrcs` files but only 1000 of them

src.save("my_source_DS64.star") # saves new images as `my_source_DS64_0_511.mrcs, my_source_DS64_512_1023.mrcs` etc

src.save("my_source_DS64.star", overwrite=True) # deletes all old `mrcs` saves new images as `my_source_DS64_0_511.mrcs, my_source_DS64_512_1023.mrcs` etc

Metadata

Metadata

Assignees

No one assigned

    Labels

    cleanupquestionFurther information is requested

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions