Skip to content

Fft - #3

Merged
Jammy2211 merged 5 commits into
masterfrom
FFT
Mar 30, 2020
Merged

Fft#3
Jammy2211 merged 5 commits into
masterfrom
FFT

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

No description provided.


def __init__(self, data, noise_map, exposure_time_map=None, name=None):
def __init__(
self, data, noise_map, exposure_time_map=None, name=None, metadata=None

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add type hints and put arguments over new lines


self.preload_transform = preload_transform

if preload_transform:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of thing might be better done using lazy instantiation

class TransformerFFT(object):
def __init__(self, uv_wavelengths, grid):

super(TransformerFFT, self).__init__()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just call super().init() in python3

return [real_transformed_mapping_matrix, imag_transformed_mapping_matrix]


class TransformerFFT(object):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to inherit from object in python 3


self.u_fft = np.fft.fftshift(
np.fft.fftfreq(
grid.shape_2d[0], grid.pixel_scales[0] * units.arcsec.to(units.rad)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.u_fft, self.v_fft = [... for i in (1, 2)]

* 1j
* (
self.grid.pixel_scales[0]
/ 2.0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe break this equation up?

)
)

self.uv = np.array(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if array is happy to accept an iterable meaning you don't need to cast to list?

list(zip(self.uv_wavelengths[:, 0], self.uv_wavelengths[:, 1]))
)

def visibilities_from_image(self, image):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a type hint

# ...
z_fft_shifted = z_fft * self.shift

# ...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Errr?


def transformed_mapping_matrices_from_mapping_matrix(self, mapping_matrix):
"""
...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs

class TransformerNUFFT(NUFFT_cpu):
def __init__(self, uv_wavelengths, grid):

super(TransformerNUFFT, self).__init__()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs, no need to pass super args


def initialize_plan(self, ratio=2, interpolation_kernel=(6, 6)):

if not isinstance(ratio, int):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary?

@Jammy2211
Jammy2211 merged commit fa6c697 into master Mar 30, 2020
@rhayes777

Copy link
Copy Markdown
Collaborator

You're supposed to fix the issues before you merge it!

@Jammy2211

Copy link
Copy Markdown
Collaborator Author

You're supposed to fix the issues before you merge it!

Ah, the thing at the bottom said approved, never saw it does it on a commit by commit basis.

This transformer stuff is scientifically untested so I dont want to spend too much time on documenting / cleaning the code currently. We could be using a completely different library in a months time.

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.

2 participants