Skip to content

Commit

Permalink
Taking care of spurious file changes
Browse files Browse the repository at this point in the history
Changes were made to release 5.0.5 branch and attempted to be reverted 2 years ago. For reasons lost in the mists of time, 3 months later branch 5.0.5 was merged into this branch even though it was based on main and not being released?  This led to 4 files from @dehoni work in a completely different branch becoming part of the changes in this branch compared to main. By usind checkout main --file, I've now updated the offending files with what is currently in main (the base) so that they should no longer be part of the pull request.
  • Loading branch information
butlerpd committed Mar 25, 2024
1 parent 5f0cc3d commit 6e237d1
Show file tree
Hide file tree
Showing 4 changed files with 12,929 additions and 52 deletions.
78 changes: 31 additions & 47 deletions src/sas/sascalc/calculator/sas_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1062,66 +1062,67 @@ def read(self, path):
# Reading Header; Segment count ignored
s_line = line.split(":", 1)
if s_line[0].lower().count("oommf") > 0:
oommf = s_line[1].lstrip()
if len(s_line) < 2: s_line = line.split(" ",1)
oommf = s_line[1].strip()

if s_line[0].lower().count("title") > 0:
title = s_line[1].lstrip()
title = s_line[1].strip()
if s_line[0].lower().count("desc") > 0:
desc += s_line[1].lstrip()
desc += s_line[1].strip()
desc += '\n'
if s_line[0].lower().count("meshtype") > 0:
meshtype = s_line[1].lstrip()
meshtype = s_line[1].strip()
if s_line[0].lower().count("meshunit") > 0:
meshunit = s_line[1].lstrip()
meshunit = s_line[1].strip()
if meshunit.count("m") < 1:
msg = "Error: \n"
msg += "We accept only m as meshunit"
logging.error(msg)
return None
if s_line[0].lower().count("xbase") > 0:
xbase = s_line[1].lstrip()
xbase = s_line[1].strip()
if s_line[0].lower().count("ybase") > 0:
ybase = s_line[1].lstrip()
ybase = s_line[1].strip()
if s_line[0].lower().count("zbase") > 0:
zbase = s_line[1].lstrip()
zbase = s_line[1].strip()
if s_line[0].lower().count("xstepsize") > 0:
xstepsize = s_line[1].lstrip()
xstepsize = s_line[1].strip()
if s_line[0].lower().count("ystepsize") > 0:
ystepsize = s_line[1].lstrip()
ystepsize = s_line[1].strip()
if s_line[0].lower().count("zstepsize") > 0:
zstepsize = s_line[1].lstrip()
zstepsize = s_line[1].strip()
if s_line[0].lower().count("xnodes") > 0:
xnodes = s_line[1].lstrip()
#print(s_line[0].lower().count("ynodes"))
xnodes = s_line[1].strip()
if s_line[0].lower().count("ynodes") > 0:
ynodes = s_line[1].lstrip()
#print(ynodes)
ynodes = s_line[1].strip()
if s_line[0].lower().count("znodes") > 0:
znodes = s_line[1].lstrip()
znodes = s_line[1].strip()
if s_line[0].lower().count("xmin") > 0:
xmin = s_line[1].lstrip()
xmin = s_line[1].strip()
if s_line[0].lower().count("ymin") > 0:
ymin = s_line[1].lstrip()
ymin = s_line[1].strip()
if s_line[0].lower().count("zmin") > 0:
zmin = s_line[1].lstrip()
zmin = s_line[1].strip()
if s_line[0].lower().count("xmax") > 0:
xmax = s_line[1].lstrip()
xmax = s_line[1].strip()
if s_line[0].lower().count("ymax") > 0:
ymax = s_line[1].lstrip()
ymax = s_line[1].strip()
if s_line[0].lower().count("zmax") > 0:
zmax = s_line[1].lstrip()
zmax = s_line[1].strip()
if s_line[0].lower().count("valueunit") > 0:
valueunit = s_line[1].lstrip()
valueunit = s_line[1].strip()
if valueunit.count("mT") < 1 and valueunit.count("A/m") < 1:
msg = "Error: \n"
msg += "We accept only mT or A/m as valueunit"
logging.error(msg)
return None
elif "mT" in valueunit or "A/m" in valueunit:
valueunit = valueunit.split(" ", 1)
valueunit = valueunit[0].strip()
if s_line[0].lower().count("valuemultiplier") > 0:
valuemultiplier = s_line[1].lstrip()
if s_line[0].lower().count("valuerangeminmag") > 0:
valuerangeminmag = s_line[1].lstrip()
if s_line[0].lower().count("valuerangemaxmag") > 0:
valuerangemaxmag = s_line[1].lstrip()
valuemultiplier = s_line[1].strip()
else:
valuemultiplier = 1
if s_line[0].lower().count("end") > 0:
output.filename = os.path.basename(path)
output.oommf = oommf
Expand All @@ -1144,10 +1145,6 @@ def read(self, path):
output.ymax = float(ymax) * METER2ANG
output.zmax = float(zmax) * METER2ANG
output.valuemultiplier = valuemultiplier
output.valuerangeminmag \
= mag2sld(float(valuerangeminmag), valueunit)
output.valuerangemaxmag \
= mag2sld(float(valuerangemaxmag), valueunit)
mx = np.reshape(mx, (len(mx),))
my = np.reshape(my, (len(my),))
mz = np.reshape(mz, (len(mz),))
Expand Down Expand Up @@ -1422,8 +1419,7 @@ def __init__(self):
self.my = None
self.mz = None
self.valuemultiplier = 1.
self.valuerangeminmag = 0
self.valuerangemaxmag = 0


def __str__(self):
"""
Expand Down Expand Up @@ -1456,10 +1452,7 @@ def __str__(self):
_str += "zmax: %s [%s]\n" % (str(self.zmax), self.meshunit)
_str += "valueunit: %s\n" % self.valueunit
_str += "valuemultiplier: %s\n" % str(self.valuemultiplier)
_str += "ValueRangeMinMag:%s [%s]\n" % (str(self.valuerangeminmag),
self.valueunit)
_str += "ValueRangeMaxMag:%s [%s]\n" % (str(self.valuerangemaxmag),
self.valueunit)

return _str

def set_m(self, mx, my, mz):
Expand Down Expand Up @@ -1520,10 +1513,6 @@ def __init__(self, pos_x, pos_y, pos_z, sld_n=None,
self.sld_mz = sld_mz
self.vol_pix = vol_pix
self.data_length = len(pos_x)
#self.sld_m = None
#self.sld_phi = None
#self.sld_theta = None
#self.sld_phi = None
self.pix_symbol = None
if sld_mx is not None and sld_my is not None and sld_mz is not None:
self.set_sldms(sld_mx, sld_my, sld_mz)
Expand Down Expand Up @@ -1591,11 +1580,6 @@ def set_sldms(self, sld_mx, sld_my, sld_mz):
else:
self.sld_mz = sld_mz

#sld_m = np.sqrt(sld_mx**2 + sld_my**2 + sld_mz**2)
#if isinstance(sld_m, float):
# self.sld_m = np.full_like(self.pos_x, sld_m)
#else:
# self.sld_m = sld_m

def set_pixel_symbols(self, symbol='pixel'):
"""
Expand Down
Loading

0 comments on commit 6e237d1

Please # to comment.