Skip to content

Allows FDCT to be picklable so they can be used with BlockDiag(nproc>1) #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cako
Copy link
Collaborator

@cako cako commented Jun 7, 2025

Description

Allows FDCT to be picklable so they can be used with BlockDiag(nproc>1)

Changes

  • Implements __getstate__ and __setstate__ in base FDCT.

Test script

import numpy as np

from pylops import BlockDiag
from curvelops import FDCT2D

nr = 10
ns = 312
nt = 1016

nbscales = 4
nbangles_coarse = 8
allcurvelets = False

DCTOp = FDCT2D((ns, nt), nbscales=nbscales,
    nbangles_coarse=nbangles_coarse,
    allcurvelets=allcurvelets, dtype="complex64")

DCTOp1 = DCTOp.H

SopDiag = []
for i in range(nr):
    SopDiag.append(DCTOp1)
SopDiag = BlockDiag(SopDiag, nproc=2)

data = np.zeros(SopDiag.shape[1])
SopDiag @ data # This errors in the main branch

@cako cako marked this pull request as ready for review June 14, 2025 18:04
@cako cako requested a review from mrava87 June 14, 2025 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant