Skip to content

Commit

Permalink
Update CAP406
Browse files Browse the repository at this point in the history
  • Loading branch information
drlaw1558 committed Apr 9, 2021
1 parent f907f91 commit 6208928
Show file tree
Hide file tree
Showing 3 changed files with 488 additions and 114 deletions.
562 changes: 461 additions & 101 deletions miricoord/mrs/makedither/makedither_mrs.ipynb

Large diffs are not rendered by default.

40 changes: 27 additions & 13 deletions miricoord/mrs/makedither/makedither_mrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ def makepattern_generic(astart,along,ashort,bstart,blong,bshort):
def maxfwhm(channel):
# Maximum wavelength in microns for the channel
wave=0.
if (channel is 1): wave=8.0
if (channel is 2): wave=12.0
if (channel is 3): wave=18.0
if (channel is 4): wave=29.0
if (channel == 1): wave=8.0
if (channel == 2): wave=12.0
if (channel == 3): wave=18.0
if (channel == 4): wave=29.0

return 0.31*wave/8.0

Expand Down Expand Up @@ -438,9 +438,11 @@ def writeresults_prd(dxidl,dyidl,outdir=''):
# Set the default output data directory if it was not provided
if (outdir == ''):
data_dir=os.path.expandvars('$MIRICOORD_DATA_DIR')
outdir=os.path.join(data_dir,'dithers/temp/')
# Set the output filename
outfile=os.path.join(outdir,'MiriMrsDithers.txt')
relfile='dithers/temp/MiriMrsDithers.txt'
outfile=os.path.join(data_dir,relfile)
else:
relfile='MiriMrsDithers.txt'
outfile=os.path.join(outdir,relfile)

now=datetime.datetime.now()
thisfile=__file__
Expand Down Expand Up @@ -513,6 +515,9 @@ def writeresults_prd(dxidl,dyidl,outdir=''):
for ii in range(48,52):
print("{0:<3}{1:>10.6f} {2:>10.6f}".format(ii-47,dxidl[ii],dyidl[ii]),file=open(outfile,"a"))
print('',file=open(outfile,"a"))

# Log the operation is complete
print('Successfully wrote PRD dithers file to ',relfile)

#############################

Expand All @@ -522,9 +527,11 @@ def writeresults_mirisim(ch,v2,v3,outdir=''):
# Set the default output data directory if it was not provided
if (outdir == ''):
data_dir=os.path.expandvars('$MIRICOORD_DATA_DIR')
outdir=os.path.join(data_dir,'dithers/temp/')
# Set the output filename
outfile=os.path.join(outdir,'mrs_recommended_dither.dat')
relfile='dithers/temp/mrs_recommended_dither.dat'
outfile=os.path.join(data_dir,relfile)
else:
relfile='mrs_recommended_dither.dat'
outfile=os.path.join(outdir,relfile)

now=datetime.datetime.now()
thisfile=__file__
Expand Down Expand Up @@ -608,6 +615,8 @@ def writeresults_mirisim(ch,v2,v3,outdir=''):
for ii in range(48,52):
print("{0:>7.4f}, {1:>7.4f}".format(dalpha[ii],dbeta[ii]),file=open(outfile,"a"))

# Log the operation is complete
print('Successfully wrote mirisim dithers file to ',relfile)

#############################

Expand All @@ -617,9 +626,11 @@ def writeresults_full(index,ch,v2,v3,dxidl,dyidl,outdir=''):
# Set the default output data directory if it was not provided
if (outdir == ''):
data_dir=os.path.expandvars('$MIRICOORD_DATA_DIR')
outdir=os.path.join(data_dir,'dithers/temp/')
# Set the output filename
outfile=os.path.join(outdir,'mrs_dithers.txt')
relfile='dithers/temp/mrs_dithers.txt'
outfile=os.path.join(data_dir,relfile)
else:
relfile='mrs_dithers.txt'
outfile=os.path.join(outdir,relfile)

now=datetime.datetime.now()
thisfile=__file__
Expand Down Expand Up @@ -649,6 +660,9 @@ def writeresults_full(index,ch,v2,v3,dxidl,dyidl,outdir=''):
# Write information to a text file
print("{0:<10} {1:<8} {2:<10.5f} {3:<10.5f} {4:<10.5f} {5:<10.5f} {6:<15.5f} {7:<15.5f}".format(index[i],band[i],dalpha[i],dbeta[i],v2[i],v3[i],dxidl[i],dyidl[i]),file=open(outfile,"a"))

# Log the operation is complete
print('Successfully wrote full dithers file to ',relfile)

#############################

# Plot showing the location of the point-source dithers
Expand Down
Binary file added miricoord/mrs/makedither/stsci_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6208928

Please sign in to comment.