Skip to content
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

Initial refactoring #4

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

Initial refactoring #4

wants to merge 2 commits into from

Conversation

samaloney
Copy link
Collaborator

  • Now works on some data obatained from vso
  • Removed some repeated code
  • Formating and imports

* Now works on some data obatained from vso
* Removed some repeated code
* Formating and imports
Copy link
Contributor

@PaulJWright PaulJWright left a comment

Choose a reason for hiding this comment

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

Looks fine by me, thanks!

* Might work on windows now
* Sperate CLI from funcions
* Docstrings
* Pass config as dict
* Address lint and format warnings and errors
@samaloney samaloney changed the title WIP: Initial refactoring Initial refactoring Apr 26, 2020
@samaloney
Copy link
Collaborator Author

So further updates also see comments on this PR

if instrument == 'mdi':
run = 'checkpoints/mdi/20200312194454_HighResNet_RPRCDO_SSIMGradHistLoss_mdi_19'
run_dir = Path('checkpoints/mdi/20200312194454_HighResNet_RPRCDO_SSIMGradHistLoss_mdi_19')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should alway try to use pathlib.Path for all paths in general also if we want this work on window is is a must.

@@ -14,7 +14,5 @@ torch==1.1.0
torchvision==0.3.0
tensorboard==1.14.0
tensorboardX==1.8
gitpython==3.1.0
tensorflow==1.15.2
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should remove any other used requirements

Copy link
Contributor

Choose a reason for hiding this comment

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

should there be a python requirement in here?


from source.utils import disable_warnings, get_logger

disable_warnings()
logger = get_logger(__name__)


def map_prep(file, instrument, *keyward_args):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

kwargs weren't used

header['RSUN_REF'] = 696000000

# Adding distance to header
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed currently unused/supported instruments

@@ -383,21 +294,20 @@ def plot_magnetogram(amap, file, scale=1, vmin=-2000, vmax=2000, cmap=plt.cm.get
ppxx = pxx / fszh # Horizontal size of each panel in relative units
ppxy = pxy / fszv # Vertical size of each panel in relative units
ppadv = padv / fszv # Vertical padding in relative units
ppadv2 = padv2 / fszv # Vertical padding in relative units
# Never used so commented out
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

these are not ever used I would delete them but no totally sure what they are for?


# Detecting need for rescale
if rescale and np.abs(1 - (map.meta['cdelt1']/0.504273)/upscale_factor) > 0.01:
map = scale_rotate(map, target_factor=upscale_factor)
if self.rescale and np.abs(1 - (amap.meta['cdelt1']/0.504273) / self.upscale_factor) > 0.01:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a bit of a magic number not totally sure what we are doing here I would suggest

  1. create a constant at the top for the file and reference that or
  2. since this is a class put it in the __init__ with a default value and document it

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.

None yet

2 participants