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

testing #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ EdgeML for Fusion Energy Science project
This work was supported by the Department of Energy, Office of Fusion Energy Science under Field Work Proposal 100636 "Machine Learning for Real-time Fusion Plasma Behavior Prediction and Manipulation."
This material is based upon work supported by the U.S. Department of Energy, Office of Science, Office of Fusion Energy Sciences, using the DIII-D National Fusion Facility, a DOE Office of Science user facility, under Award DE-FC02-04ER54698.

# Super-resolution
Connect with Raffi Nazikian with the Thomas Feurer paper on time-domain ptychography.
Also run a test of using random incommensurate sampling in time to recover higher frequency information from across channels of diagnostics. How low of sampling can we do if we do stochastic distribution of sample times?

# Example filenames in sdf filesystem accessed via s3df
Each file is aobut 80% of a GB. Counting 158-187k of them at 1GB each would gives a max of 29 thousand of 1GB files would be 29 TB.
I believe there is heavy duplication in the "time" variable that I will check for future reference.
Expand Down
8 changes: 4 additions & 4 deletions src/ParaClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def initTimesChans(self,f): # updated for Finn ecebes_######.h5 input files.

def fillData(self,f): # updated for Finn ecebes_######.h5 input files.
for dk,d in self.dets.items():
self.data[dk] = [(f[d][c][()]*(1<<10)).astype(np.int16) for c in self.chans[dk]]
self.data[dk] = [(f[d][c][()]).astype(np.float16) for c in self.chans[dk]]
return self

def setMethod(self,x='fft'):
Expand Down Expand Up @@ -180,11 +180,11 @@ def processFFT(self,h5out):
ELMX = X*self.elm_filt[detkey]
elm_back = irfft(ELMX,norm='forward')
Params.setElm(h5out,detkey,chan,data=elm_back[:self.nsamples[detkey],:])
S = utils.saturate_uint(np.abs(X).real,self.satbits).astype(np.uint16)
S = utils.saturate_float(np.abs(X).real,np.float16(self.nsamples[detkey]<<3)).astype(np.float16)
Params.setSpect(h5out,detkey,chan,data=S)
Q = rfft(np.concatenate((S.astype(float),np.flip(S.astype(float),axis=0)),axis=0),axis=0)
Sback = utils.saturate_uint(irfft(Q*self.q_filt[detkey],axis=0).real,self.satbits).astype(np.uint16)
dSback = utils.saturate_int(irfft(Q*1j*self.dq_filt[detkey],axis=0).real.astype(int)>>6,self.satbits).astype(np.int16)
Sback = utils.saturate_float(irfft(Q*self.q_filt[detkey],axis=0).real,np.float16(self.nsamples[detkey])).astype(np.float16)
dSback = utils.saturate_float(irfft(Q*1j*self.dq_filt[detkey],axis=0).real.astype(np.float16),np.float16(self.nsamples[detkey])**2).astype(np.float16)
logic = dSback[offset:self.nsamples[detkey],:]
print(np.max(logic),np.min(logic))
Params.setLogic(h5out,detkey,chan,data=logic)
Expand Down
Binary file modified src/__pycache__/ParaClass.cpython-39.pyc
Binary file not shown.
Binary file modified src/__pycache__/analysis.cpython-39.pyc
Binary file not shown.
Binary file modified src/__pycache__/utils.cpython-39.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def selectchanwin(d,c1,c2):
def soft_saturate(x,limit=10):
return limit*np.tanh(x/limit)

def saturate_float(x,limit=10):
return limit*np.tanh(x/limit)

def saturate_uint(x,bits):
inds = np.where(x>((1<<bits)-1))
x[inds] = ((1<<bits)-1)
Expand Down