Correct use of .copy() when working with layers

  1. Is it always necessary to use .copy() when creating a new layer with the value of a different layer? I see some examples with and some without .copy() and can’t find any clear documentation specifying the correct use of this.

Example

adata[‘layer1’]=adata.X

vs

adata[‘layer1’]=adata.X.copy()

  1. When assigning the result of a transformation to a layer, as opposed to updating adata.X, is this the correct syntax?

adata[‘norm’] = sc.pp.normalize_total(adata, copy=True)

  1. Why is inplace=False incompatible with copy=True in the above command (per the documentation)? To me, it seems that copy=True is another way of saying inplace=False “, ie don’t update adata.X, but instead just return the output.

  2. I cannot seem to wrap my head around this sentence in the documentation for sc.pp.normalize_total :

Returns dictionary with normalized copies of adata.X and adata.layers or updates adatawith normalized version of the original adata.X and adata.layers, depending on inplace.

a) Can somebody elaborate on what it means to “return a dictionary of the normalized copies of X AND layers”? Why would you get a dictionary of transformed X AND layers if you don’t specify any layers as input? Wouldn’t you just get the transformed result of .X? Or is it normalizing all the layers in anndata? I thought the default was to only normalize .X unless any other layers are specified?

b) “Depending on inplace” — wouldn’t this depend on whether copy=True or False?

Thank you!